2 Commits

24 changed files with 141 additions and 66 deletions

View File

@@ -3,10 +3,6 @@
[ext_resource type="Script" uid="uid://b30p1yqojbbbk" path="res://core/ai/agents/base/ai_base.gd" id="1_4d1nn"] [ext_resource type="Script" uid="uid://b30p1yqojbbbk" path="res://core/ai/agents/base/ai_base.gd" id="1_4d1nn"]
[ext_resource type="Script" uid="uid://ps3vlu2qvmop" path="res://core/ai/framework/state_machine.gd" id="2_q1hg3"] [ext_resource type="Script" uid="uid://ps3vlu2qvmop" path="res://core/ai/framework/state_machine.gd" id="2_q1hg3"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_mh3lg"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_mh3lg"]
[sub_resource type="SphereShape3D" id="SphereShape3D_lim44"] [sub_resource type="SphereShape3D" id="SphereShape3D_lim44"]
radius = 20.0 radius = 20.0
@@ -14,12 +10,6 @@ radius = 20.0
script = ExtResource("1_4d1nn") script = ExtResource("1_4d1nn")
entity_name = "Humanoid" entity_name = "Humanoid"
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=214482161]
mesh = SubResource("CapsuleMesh_mh3lg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=92811823]
shape = SubResource("CapsuleShape3D_mh3lg")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=1370024449] [node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=1370024449]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -2,6 +2,8 @@
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_p2hpa"] [ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_p2hpa"]
[ext_resource type="PackedScene" uid="uid://bjp8wbrtfl4v2" path="res://core/ai/agents/cow/cow_mannequin.tscn" id="2_6gadt"] [ext_resource type="PackedScene" uid="uid://bjp8wbrtfl4v2" path="res://core/ai/agents/cow/cow_mannequin.tscn" id="2_6gadt"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_vlvvc"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_su7en"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6gadt"] [sub_resource type="BoxShape3D" id="BoxShape3D_6gadt"]
size = Vector3(1, 1.4033203, 2.201294) size = Vector3(1, 1.4033203, 2.201294)
@@ -16,38 +18,23 @@ visible = false
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.20166016, 0.24859619) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.20166016, 0.24859619)
shape = SubResource("BoxShape3D_6gadt") shape = SubResource("BoxShape3D_6gadt")
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=2033863310]
script = ExtResource("2_vlvvc")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=2076820654]
script = ExtResource("3_su7en")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
exit_on_action_finished = true
[node name="CowMannequin" parent="." index="5" unique_id=1390675137 instance=ExtResource("2_6gadt")] [node name="CowMannequin" parent="." index="5" unique_id=1390675137 instance=ExtResource("2_6gadt")]
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, -0.9, 0) transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, -0.9, 0)
[node name="Skeleton3D" parent="CowMannequin/Armature" parent_id_path=PackedInt32Array(1390675137, 698629112) index="0" unique_id=1122133347]
bones/1/position = Vector3(-0.00911771, 0.0010000349, 0.006467142)
bones/3/position = Vector3(0.0017672703, 0.020791268, -0.0029404918)
bones/4/position = Vector3(-0.0032468068, 0.0023884464, 0.01873094)
bones/4/rotation = Quaternion(0.10042217, -0.10042243, 0.69993955, 0.69993955)
bones/5/rotation = Quaternion(0.67686933, -0.7237772, -0.07669845, 0.11005373)
bones/6/rotation = Quaternion(0.2912588, -0.018159404, 0.0055299345, 0.95645595)
bones/8/position = Vector3(-0.0032468068, 0.003527336, -0.02178527)
bones/8/rotation = Quaternion(-0.13840333, 0.13840266, 0.6934296, 0.6934297)
bones/9/rotation = Quaternion(0.63873273, -0.71572495, 0.1725141, -0.22360067)
bones/10/rotation = Quaternion(-0.5624951, 0.015998652, 0.010887203, 0.82657415)
bones/12/position = Vector3(0.0026304817, 0.0015686632, 0.01873094)
bones/12/rotation = Quaternion(0.69003975, 0.6900398, -0.15441875, 0.15441847)
bones/13/rotation = Quaternion(-0.06197851, -0.1282304, 0.73018706, 0.6682384)
bones/14/rotation = Quaternion(0.1410681, 0.051763278, -0.0073862504, 0.9886182)
bones/16/position = Vector3(0.0026304817, 0.005057063, -0.02178527)
bones/16/rotation = Quaternion(0.70645297, 0.7064531, 0.030399354, -0.030400336)
bones/17/rotation = Quaternion(0.198508, 0.20028433, 0.69889957, 0.65728253)
bones/18/rotation = Quaternion(-0.4085358, -0.008673466, -0.0038824743, 0.9126928)
bones/20/position = Vector3(-0.0003228268, 0.009853916, -0.026626632)
bones/26/position = Vector3(-0.00072195934, 0.0076745725, 0.016512236)
bones/26/rotation = Quaternion(0.0042201285, 0.8477673, 0.5299017, -0.021842854)
bones/27/rotation = Quaternion(0.1513493, -0.04170839, -0.04666066, 0.9864972)
bones/28/rotation = Quaternion(-0.6312453, -0.17917253, 0.17600863, 0.73378986)
bones/30/position = Vector3(-0.0003228271, 0.011335416, -0.01734586)
bones/33/position = Vector3(-0.008358625, 0.004613471, -0.013200058)
bones/33/rotation = Quaternion(0.76341635, -5.672201e-07, -6.704141e-07, 0.6459068)
bones/35/position = Vector3(0.008608938, 0.0010000349, 0.028441517)
bones/35/rotation = Quaternion(0.7071068, -6.866289e-07, -1.22965e-06, 0.7071067)
bones/37/position = Vector3(0.007849856, 0.0010000349, -0.02901155)
[editable path="CowMannequin"] [editable path="CowMannequin"]

View File

@@ -12,7 +12,7 @@ _data = {
[node name="CowMannequin" unique_id=786985233 instance=ExtResource("1_60f5q")] [node name="CowMannequin" unique_id=786985233 instance=ExtResource("1_60f5q")]
[node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(698629112) index="0" unique_id=1122133347] [node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(792301245) index="0" unique_id=1950086664]
bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067) bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/1/scale = Vector3(1, 1, 1) bones/1/scale = Vector3(1, 1, 1)
bones/4/rotation = Quaternion(0.0015316998, -0.0015319793, 0.70710516, 0.70710516) bones/4/rotation = Quaternion(0.0015316998, -0.0015319793, 0.70710516, 0.70710516)
@@ -77,5 +77,5 @@ bones/35/scale = Vector3(1, 1, 1)
bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067) bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/37/scale = Vector3(1, 1, 1) bones/37/scale = Vector3(1, 1, 1)
[node name="AnimationPlayer" parent="." index="1" unique_id=1944296898] [node name="AnimationPlayer" parent="." index="1" unique_id=1401028430]
libraries/custom = SubResource("AnimationLibrary_lowte") libraries/custom = SubResource("AnimationLibrary_lowte")

Binary file not shown.

Binary file not shown.

View File

@@ -2,6 +2,8 @@
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_e5v3h"] [ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_e5v3h"]
[ext_resource type="PackedScene" uid="uid://dqhueybnlrrqx" path="res://core/ai/agents/horse/horse_mannequin.tscn" id="2_4t6jw"] [ext_resource type="PackedScene" uid="uid://dqhueybnlrrqx" path="res://core/ai/agents/horse/horse_mannequin.tscn" id="2_4t6jw"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_or6xs"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_n63jb"]
[ext_resource type="Animation" uid="uid://doyi6etqvy4n2" path="res://core/ai/agents/horse/idle.res" id="3_qe4rt"] [ext_resource type="Animation" uid="uid://doyi6etqvy4n2" path="res://core/ai/agents/horse/idle.res" id="3_qe4rt"]
[ext_resource type="Animation" uid="uid://hotr7r3fd1sq" path="res://core/ai/agents/horse/walking.res" id="4_q8m0v"] [ext_resource type="Animation" uid="uid://hotr7r3fd1sq" path="res://core/ai/agents/horse/walking.res" id="4_q8m0v"]
@@ -24,10 +26,26 @@ visible = false
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2074585, 0.14794922) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2074585, 0.14794922)
shape = SubResource("BoxShape3D_4t6jw") shape = SubResource("BoxShape3D_4t6jw")
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=734754793]
script = ExtResource("2_or6xs")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1748382252]
script = ExtResource("3_n63jb")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
exit_on_action_finished = true
[node name="HorseMannequin" parent="." index="5" unique_id=1289880358 instance=ExtResource("2_4t6jw")] [node name="HorseMannequin" parent="." index="5" unique_id=1289880358 instance=ExtResource("2_4t6jw")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0) transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="HorseMannequin/Armature" parent_id_path=PackedInt32Array(1289880358, 502167939) index="0" unique_id=972507008] [node name="Skeleton3D" parent="HorseMannequin/Armature" parent_id_path=PackedInt32Array(1289880358, 245823720) index="0" unique_id=494955820]
bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067) bones/1/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.7071067)
bones/4/rotation = Quaternion(0.0012952884, -0.0012955684, 0.7071056, 0.7071057) bones/4/rotation = Quaternion(0.0012952884, -0.0012955684, 0.7071056, 0.7071057)
bones/5/rotation = Quaternion(0.70685357, -0.70227593, -0.04508998, 0.07164877) bones/5/rotation = Quaternion(0.70685357, -0.70227593, -0.04508998, 0.07164877)
@@ -55,7 +73,7 @@ bones/33/rotation = Quaternion(0.7071068, -6.209646e-07, -6.209645e-07, 0.707106
bones/35/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067) bones/35/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067) bones/37/rotation = Quaternion(0.7071068, -9.581396e-07, -9.581394e-07, 0.7071067)
[node name="AnimationPlayer" parent="HorseMannequin" index="1" unique_id=868895357] [node name="AnimationPlayer" parent="HorseMannequin" index="1" unique_id=272680130]
libraries/custom = SubResource("AnimationLibrary_or6xs") libraries/custom = SubResource("AnimationLibrary_or6xs")
[editable path="HorseMannequin"] [editable path="HorseMannequin"]

Binary file not shown.

Binary file not shown.

View File

@@ -20,6 +20,6 @@ script = ExtResource("3_8d0tj")
state_id = &"patrol" state_id = &"patrol"
next_state_id = &"idle" next_state_id = &"idle"
animation_name = "custom/walking" animation_name = "custom/walking"
wait_time = 0.0 exit_on_action_finished = true
[editable path="HumanMannequin"] [editable path="HumanMannequin"]

View File

@@ -14,7 +14,7 @@ script = ExtResource("3_2oda6")
state_id = &"patrol" state_id = &"patrol"
next_state_id = &"gather" next_state_id = &"gather"
animation_name = "custom/walking" animation_name = "custom/walking"
wait_time = 0.0 exit_on_action_finished = true
[node name="GatherState" type="Node" parent="StateMachine" index="1" unique_id=48091671] [node name="GatherState" type="Node" parent="StateMachine" index="1" unique_id=48091671]
script = ExtResource("4_2oda6") script = ExtResource("4_2oda6")
@@ -22,6 +22,5 @@ state_id = &"gather"
next_state_id = &"patrol" next_state_id = &"patrol"
animation_name = "custom/gather" animation_name = "custom/gather"
exit_on_animation_finished = true exit_on_animation_finished = true
wait_time = 1.0
[editable path="HumanMannequin"] [editable path="HumanMannequin"]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,8 +1,10 @@
[gd_scene format=3 uid="uid://c2hg6hu2y5srb"] [gd_scene format=3 uid="uid://c2hg6hu2y5srb"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_j8spt"] [ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_j8spt"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_acc6o"]
[ext_resource type="PackedScene" uid="uid://b0xb7kl4rjd66" path="res://core/ai/agents/pig/pig_mannequin.tscn" id="2_qmc2e"] [ext_resource type="PackedScene" uid="uid://b0xb7kl4rjd66" path="res://core/ai/agents/pig/pig_mannequin.tscn" id="2_qmc2e"]
[ext_resource type="Animation" uid="uid://cneiflmpalcg5" path="res://core/ai/agents/pig/idle.res" id="3_lvpc5"] [ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_3n8ak"]
[ext_resource type="Animation" uid="uid://c4ingpw0co8v2" path="res://core/ai/agents/pig/idle.res" id="3_lvpc5"]
[ext_resource type="Animation" uid="uid://0563r715lmw1" path="res://core/ai/agents/pig/walking.res" id="4_3f3hl"] [ext_resource type="Animation" uid="uid://0563r715lmw1" path="res://core/ai/agents/pig/walking.res" id="4_3f3hl"]
[sub_resource type="BoxShape3D" id="BoxShape3D_lvpc5"] [sub_resource type="BoxShape3D" id="BoxShape3D_lvpc5"]
@@ -24,10 +26,26 @@ visible = false
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.24243164, 0.10699463) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.24243164, 0.10699463)
shape = SubResource("BoxShape3D_lvpc5") shape = SubResource("BoxShape3D_lvpc5")
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=403305255]
script = ExtResource("2_acc6o")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1237150984]
script = ExtResource("3_3n8ak")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
exit_on_action_finished = true
[node name="PigMannequin" parent="." index="5" unique_id=926755470 instance=ExtResource("2_qmc2e")] [node name="PigMannequin" parent="." index="5" unique_id=926755470 instance=ExtResource("2_qmc2e")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0) transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="PigMannequin/Armature" parent_id_path=PackedInt32Array(926755470, 1135672511) index="0" unique_id=689596368] [node name="Skeleton3D" parent="PigMannequin/Armature" parent_id_path=PackedInt32Array(926755470, 695496535) index="0" unique_id=725647261]
bones/1/rotation = Quaternion(0.7071068, -7.052583e-07, -7.052583e-07, 0.7071067) bones/1/rotation = Quaternion(0.7071068, -7.052583e-07, -7.052583e-07, 0.7071067)
bones/3/position = Vector3(5.37765e-05, 0.017809996, -0.007695386) bones/3/position = Vector3(5.37765e-05, 0.017809996, -0.007695386)
bones/3/rotation = Quaternion(-0.027121998, 0, 0, 0.99963224) bones/3/rotation = Quaternion(-0.027121998, 0, 0, 0.99963224)
@@ -62,7 +80,7 @@ bones/31/rotation = Quaternion(0.7071068, -1.0424332e-06, -1.0424329e-06, 0.7071
bones/33/position = Vector3(0.010670463, 0.0010000349, -0.03166372) bones/33/position = Vector3(0.010670463, 0.0010000349, -0.03166372)
bones/33/rotation = Quaternion(0.70755845, -7.1388774e-07, -1.0355643e-06, 0.7066547) bones/33/rotation = Quaternion(0.70755845, -7.1388774e-07, -1.0355643e-06, 0.7066547)
[node name="AnimationPlayer" parent="PigMannequin" index="1" unique_id=1348500176] [node name="AnimationPlayer" parent="PigMannequin" index="1" unique_id=904091745]
libraries/custom = SubResource("AnimationLibrary_lvpc5") libraries/custom = SubResource("AnimationLibrary_lvpc5")
[editable path="PigMannequin"] [editable path="PigMannequin"]

Binary file not shown.

View File

@@ -1,9 +1,11 @@
[gd_scene format=3 uid="uid://2md4l83fy8kr"] [gd_scene format=3 uid="uid://2md4l83fy8kr"]
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_0bu1i"] [ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_0bu1i"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_iapui"]
[ext_resource type="PackedScene" uid="uid://c16j3umhplew4" path="res://core/ai/agents/pug/pug_mannequin.tscn" id="2_n0mit"] [ext_resource type="PackedScene" uid="uid://c16j3umhplew4" path="res://core/ai/agents/pug/pug_mannequin.tscn" id="2_n0mit"]
[ext_resource type="Animation" uid="uid://cwrfo6h44qghm" path="res://core/ai/agents/pug/idle.res" id="3_hv1px"] [ext_resource type="Animation" uid="uid://c8hy2tftqb7su" path="res://core/ai/agents/pug/idle.res" id="3_hv1px"]
[ext_resource type="Animation" uid="uid://dbv2ikwa8h4nb" path="res://core/ai/agents/pug/walking.res" id="4_cjq2y"] [ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_xc1yq"]
[ext_resource type="Animation" uid="uid://bqrhidcnublea" path="res://core/ai/agents/pug/walking.res" id="4_cjq2y"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_iapui"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_iapui"]
_data = { _data = {
@@ -17,10 +19,26 @@ anim_player = NodePath("PugMannequin/AnimationPlayer")
[node name="MeshInstance3D" parent="." index="0" unique_id=214482161] [node name="MeshInstance3D" parent="." index="0" unique_id=214482161]
visible = false visible = false
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=1079848975]
script = ExtResource("2_iapui")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1573670396]
script = ExtResource("3_xc1yq")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
exit_on_action_finished = true
[node name="PugMannequin" parent="." index="5" unique_id=1732134047 instance=ExtResource("2_n0mit")] [node name="PugMannequin" parent="." index="5" unique_id=1732134047 instance=ExtResource("2_n0mit")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0) transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Skeleton3D" parent="PugMannequin/Armature" parent_id_path=PackedInt32Array(1732134047, 251322627) index="0" unique_id=1067550931] [node name="Skeleton3D" parent="PugMannequin/Armature" parent_id_path=PackedInt32Array(1732134047, 199608791) index="0" unique_id=33809722]
bones/8/position = Vector3(-0.0054483665, 0.008346455, -0.020266803) bones/8/position = Vector3(-0.0054483665, 0.008346455, -0.020266803)
bones/8/rotation = Quaternion(-0.007561639, 0.007561228, 0.70706636, 0.70706636) bones/8/rotation = Quaternion(-0.007561639, 0.007561228, 0.70706636, 0.70706636)
bones/9/rotation = Quaternion(0.6665347, -0.6790185, 0.20055033, -0.23333457) bones/9/rotation = Quaternion(0.6665347, -0.6790185, 0.20055033, -0.23333457)
@@ -34,7 +52,7 @@ bones/20/rotation = Quaternion(0.6013276, -0.007656022, 0.017799761, 0.79876757)
bones/24/rotation = Quaternion(-0.45064288, -0.22904137, 0.090387635, 0.858074) bones/24/rotation = Quaternion(-0.45064288, -0.22904137, 0.090387635, 0.858074)
bones/27/rotation = Quaternion(0.05229574, 5.703821e-05, -0.025155801, 0.99831474) bones/27/rotation = Quaternion(0.05229574, 5.703821e-05, -0.025155801, 0.99831474)
[node name="AnimationPlayer" parent="PugMannequin" index="1" unique_id=2146190163] [node name="AnimationPlayer" parent="PugMannequin" index="1" unique_id=1653203922]
libraries/custom = SubResource("AnimationLibrary_iapui") libraries/custom = SubResource("AnimationLibrary_iapui")
[editable path="PugMannequin"] [editable path="PugMannequin"]

Binary file not shown.

Binary file not shown.

View File

@@ -2,8 +2,10 @@
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_smbiq"] [ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_smbiq"]
[ext_resource type="PackedScene" uid="uid://58u6viv3qd63" path="res://core/ai/agents/sheep/sheep_mannequin.tscn" id="2_hnenk"] [ext_resource type="PackedScene" uid="uid://58u6viv3qd63" path="res://core/ai/agents/sheep/sheep_mannequin.tscn" id="2_hnenk"]
[ext_resource type="Animation" uid="uid://ifn4akvcgaua" path="res://core/ai/agents/sheep/idle.res" id="3_i3d22"] [ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_vlyix"]
[ext_resource type="Animation" uid="uid://52eg4664eik0" path="res://core/ai/agents/sheep/walking.res" id="4_hxh1r"] [ext_resource type="Animation" uid="uid://bjvoxmyf4vdy8" path="res://core/ai/agents/sheep/idle.res" id="3_i3d22"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_uqv5v"]
[ext_resource type="Animation" uid="uid://8r05h8e7nmic" path="res://core/ai/agents/sheep/walking.res" id="4_hxh1r"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hnenk"] [sub_resource type="BoxShape3D" id="BoxShape3D_hnenk"]
size = Vector3(1, 1.4770508, 1.3725281) size = Vector3(1, 1.4770508, 1.3725281)
@@ -24,13 +26,29 @@ visible = false
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.23852539, 0.11299133) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.23852539, 0.11299133)
shape = SubResource("BoxShape3D_hnenk") shape = SubResource("BoxShape3D_hnenk")
[node name="StateMachine" parent="." index="3" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("IdleState")
[node name="IdleState" type="Node" parent="StateMachine" index="0" unique_id=190711451]
script = ExtResource("2_vlyix")
state_id = &"idle"
next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=431976868]
script = ExtResource("3_uqv5v")
state_id = &"patrol"
next_state_id = &"idle"
animation_name = "custom/walking"
exit_on_action_finished = true
[node name="SheepMannequin" parent="." index="5" unique_id=1153770042 instance=ExtResource("2_hnenk")] [node name="SheepMannequin" parent="." index="5" unique_id=1153770042 instance=ExtResource("2_hnenk")]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0) transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.9, 0)
[node name="Armature" parent="SheepMannequin" index="0" unique_id=1644576745] [node name="Armature" parent="SheepMannequin" index="0" unique_id=62421163]
transform = Transform3D(100, 0, 0, 0, -4.3711384e-06, 99.99999, 0, -99.99999, -4.3711384e-06, 0, 0, 0) transform = Transform3D(100, 0, 0, 0, -4.3711384e-06, 99.99999, 0, -99.99999, -4.3711384e-06, 0, 0, 0)
[node name="AnimationPlayer" parent="SheepMannequin" index="1" unique_id=770197846] [node name="AnimationPlayer" parent="SheepMannequin" index="1" unique_id=676833932]
libraries/custom = SubResource("AnimationLibrary_vlyix") libraries/custom = SubResource("AnimationLibrary_vlyix")
[editable path="SheepMannequin"] [editable path="SheepMannequin"]

Binary file not shown.

Binary file not shown.

View File

@@ -5,8 +5,10 @@ class_name State
@export var state_id: StringName = &"" @export var state_id: StringName = &""
@export var next_state_id: StringName @export var next_state_id: StringName
@export var animation_name: String @export var animation_name: String
@export var exit_on_action_finished: bool
@export var exit_on_animation_finished: bool @export var exit_on_animation_finished: bool
@export var wait_time: float = 3.0 @export var min_wait_time: float = 3.0
@export var max_wait_time: float = 10
var runtime_timer: Timer var runtime_timer: Timer
@@ -15,7 +17,7 @@ var runtime_timer: Timer
signal transitioned(state: State, new_state_id: StringName) signal transitioned(state: State, new_state_id: StringName)
func _ready() -> void: func _ready() -> void:
if wait_time > 0: if min_wait_time > 0 and !exit_on_action_finished:
runtime_timer = Timer.new() runtime_timer = Timer.new()
runtime_timer.name = "IdleTimer" runtime_timer.name = "IdleTimer"
runtime_timer.one_shot = true runtime_timer.one_shot = true
@@ -26,7 +28,8 @@ func enter() -> void:
if exit_on_animation_finished: if exit_on_animation_finished:
if not agent.anim_player.animation_finished.is_connected(_on_animation_finished): if not agent.anim_player.animation_finished.is_connected(_on_animation_finished):
agent.anim_player.animation_finished.connect(_on_animation_finished) agent.anim_player.animation_finished.connect(_on_animation_finished)
elif wait_time > 0: elif min_wait_time > 0 and !exit_on_action_finished:
var wait_time:= randf_range(min_wait_time, max_wait_time)
runtime_timer.start(wait_time) runtime_timer.start(wait_time)
func exit() -> void: func exit() -> void:
@@ -48,7 +51,10 @@ func run_animation() -> void:
func _on_animation_finished(anim_name: StringName) -> void: func _on_animation_finished(anim_name: StringName) -> void:
if animation_name == anim_name: if animation_name == anim_name:
if wait_time > 0: if exit_on_action_finished:
return
elif min_wait_time > 0:
var wait_time := randf_range(min_wait_time, max_wait_time)
runtime_timer.start(wait_time) runtime_timer.start(wait_time)
else: else:
transitioned.emit(self, next_state_id) transitioned.emit(self, next_state_id)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

@@ -3,10 +3,16 @@
[ext_resource type="PackedScene" uid="uid://bnnuke5e7e1yr" path="res://core/ai/agents/human/ai_citizen_walker.tscn" id="1_a2xtd"] [ext_resource type="PackedScene" uid="uid://bnnuke5e7e1yr" path="res://core/ai/agents/human/ai_citizen_walker.tscn" id="1_a2xtd"]
[ext_resource type="PackedScene" uid="uid://ceqxsqfiotm5j" path="res://core/ai/agents/human/ai_farmer.tscn" id="2_n3ssi"] [ext_resource type="PackedScene" uid="uid://ceqxsqfiotm5j" path="res://core/ai/agents/human/ai_farmer.tscn" id="2_n3ssi"]
[ext_resource type="PackedScene" uid="uid://bbseno7clbepx" path="res://core/ai/agents/human/ai_citizen_sitter.tscn" id="3_fdj8t"] [ext_resource type="PackedScene" uid="uid://bbseno7clbepx" path="res://core/ai/agents/human/ai_citizen_sitter.tscn" id="3_fdj8t"]
[ext_resource type="PackedScene" uid="uid://dd8wn62anbts8" path="res://core/ai/agents/cow/ai_cow.tscn" id="4_wr508"]
[ext_resource type="PackedScene" uid="uid://cayakdk7gmlyg" path="res://core/ai/agents/horse/ai_horse.tscn" id="5_7kg15"]
[ext_resource type="PackedScene" uid="uid://c2hg6hu2y5srb" path="res://core/ai/agents/pig/ai_pig.tscn" id="6_hw7u7"]
[ext_resource type="PackedScene" uid="uid://2md4l83fy8kr" path="res://core/ai/agents/pug/ai_pug.tscn" id="7_s6v14"]
[ext_resource type="PackedScene" uid="uid://bs1bdtm7jdtgb" path="res://core/ai/agents/sheep/ai_sheep.tscn" id="8_amn6p"]
[sub_resource type="NavigationMesh" id="NavigationMesh_optuv"] [sub_resource type="NavigationMesh" id="NavigationMesh_optuv"]
vertices = PackedVector3Array(10.984741, 0.25012434, -1.0140381, 11.234741, 0.25012434, 0.23596191, 19.484741, 0.25012434, 0.23596191, 19.484741, 0.25012434, -19.514038, 9.234741, 0.25012434, -1.0140381, -19.515259, 0.25012434, -19.514038, -19.515259, 0.25012434, -0.014038086, 8.984741, 0.25012434, -0.014038086, 10.984741, 0.25012434, 1.2359619, 19.484741, 0.25012434, 19.235962, 9.234741, 0.25012434, 1.2359619, -19.515259, 0.25012434, 19.235962) vertices = PackedVector3Array(8.984741, 0.25012434, -0.014038086, 9.234741, 0.25012434, -1.0140381, -18.015259, 0.25012434, -18.014038, 17.984741, 0.25012434, 17.985962, 10.984741, 0.25012434, 1.2359619, 9.234741, 0.25012434, 1.2359619, 10.984741, 0.25012434, -1.0140381, 17.984741, 0.25012434, -18.014038, -18.015259, 0.25012434, 17.985962, 11.234741, 0.25012434, 0.23596191)
polygons = [PackedInt32Array(1, 0, 2), PackedInt32Array(2, 0, 3), PackedInt32Array(6, 5, 4), PackedInt32Array(4, 5, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(4, 7, 6), PackedInt32Array(1, 2, 8), PackedInt32Array(8, 2, 9), PackedInt32Array(6, 10, 11), PackedInt32Array(11, 10, 9), PackedInt32Array(10, 8, 9), PackedInt32Array(6, 7, 10)] polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(5, 4, 3), PackedInt32Array(7, 6, 1), PackedInt32Array(5, 8, 0), PackedInt32Array(0, 8, 2), PackedInt32Array(5, 3, 8), PackedInt32Array(1, 2, 7), PackedInt32Array(3, 4, 9), PackedInt32Array(6, 7, 9), PackedInt32Array(9, 7, 3)]
border_size = 2.0
[sub_resource type="PlaneMesh" id="PlaneMesh_optuv"] [sub_resource type="PlaneMesh" id="PlaneMesh_optuv"]
@@ -88,7 +94,7 @@ Parameters:
autowrap_mode = 2 autowrap_mode = 2
[node name="AiCitizenWalker" parent="." unique_id=1228675528 instance=ExtResource("1_a2xtd")] [node name="AiCitizenWalker" parent="." unique_id=1228675528 instance=ExtResource("1_a2xtd")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 1, -6) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.690094, 1, -11.367183)
[node name="Camera3D" type="Camera3D" parent="." unique_id=1753000680] [node name="Camera3D" type="Camera3D" parent="." unique_id=1753000680]
transform = Transform3D(1, 0, 0, 0, 0.42261824, 0.9063078, 0, -0.9063078, 0.42261824, 0, 18.361065, 15.377485) transform = Transform3D(1, 0, 0, 0, 0.42261824, 0.9063078, 0, -0.9063078, 0.42261824, 0, 18.361065, 15.377485)
@@ -98,3 +104,18 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2447205, 0.94226265, 2.9251
[node name="AiCitizenSitter" parent="." unique_id=127569260 instance=ExtResource("3_fdj8t")] [node name="AiCitizenSitter" parent="." unique_id=127569260 instance=ExtResource("3_fdj8t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.074956, 1.3552468, 11.883549) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.074956, 1.3552468, 11.883549)
[node name="AiCow" parent="." unique_id=1021070481 instance=ExtResource("4_wr508")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.4981034, 0.94226265, 15.013644)
[node name="AiHorse" parent="." unique_id=71046494 instance=ExtResource("5_7kg15")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.385908, 0.94226265, 14.142443)
[node name="AiPig" parent="." unique_id=430569938 instance=ExtResource("6_hw7u7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.327689, 0.94226265, 6.6309185)
[node name="AiPug" parent="." unique_id=1284695236 instance=ExtResource("7_s6v14")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.4858246, 0.9422617, 9.294181)
[node name="AiSheep" parent="." unique_id=806542551 instance=ExtResource("8_amn6p")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.740941, 1.1779783, 16.328548)