[gd_scene load_steps=11 format=3 uid="uid://cwvrti8hmxj0k"]

[ext_resource type="Script" uid="uid://p38hhb8jwgor" path="res://src/scripts/characters/enemy.gd" id="1_jr6vw"]
[ext_resource type="PackedScene" uid="uid://c7ahf78h5s3kx" path="res://assets/models/character/gear/tall_shield.glb" id="2_fwei0"]
[ext_resource type="PackedScene" uid="uid://ckwydalda0teo" path="res://src/scenes/characters/rig.tscn" id="2_saeby"]
[ext_resource type="PackedScene" uid="uid://csdumqcs3kutf" path="res://assets/models/character/gear/short_shield.glb" id="3_aygwl"]
[ext_resource type="PackedScene" uid="uid://bo62qyfwylypa" path="res://src/scenes/characters/area_attack.tscn" id="3_ljmr7"]
[ext_resource type="PackedScene" uid="uid://dw8f5oy13cdtx" path="res://src/scenes/characters/health_component.tscn" id="3_r8u7w"]
[ext_resource type="PackedScene" uid="uid://dh2cs460xvwjp" path="res://assets/models/character/gear/broken_sword.glb" id="6_aygwl"]

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_r8u7w"]

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ljmr7"]

[sub_resource type="CylinderShape3D" id="CylinderShape3D_fwei0"]
radius = 10.0

[node name="Enemy" type="CharacterBody3D"]
collision_layer = 9
script = ExtResource("1_jr6vw")
off_hand_items = Array[PackedScene]([ExtResource("2_fwei0"), ExtResource("3_aygwl")])

[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
avoidance_enabled = true

[node name="Timer" type="Timer" parent="."]
one_shot = true

[node name="HealthComponent" parent="." node_paths=PackedStringArray("body") instance=ExtResource("3_r8u7w")]
body = NodePath("..")

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_r8u7w")

[node name="Rig" parent="." instance=ExtResource("2_saeby")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)

[node name="Skeleton3D" parent="Rig/CharacterRig/GameRig" index="0"]
bones/0/position = Vector3(4.44089e-15, 0.910953, -0.0481736)
bones/2/rotation = Quaternion(0.00715016, -0.000270345, 0.00321101, 0.999969)
bones/3/rotation = Quaternion(-0.0883515, -0.000274197, 0.00852491, 0.996053)
bones/4/rotation = Quaternion(0.269789, 1.43987e-08, 9.16453e-08, 0.96292)
bones/6/rotation = Quaternion(-0.165313, -1.17569e-07, -1.97069e-08, 0.986241)
bones/7/position = Vector3(-3.02053e-08, 0.910953, -0.0481735)
bones/8/position = Vector3(-5.54676e-08, 0.910953, -0.0481735)
bones/9/position = Vector3(0.131144, 0.977157, -0.0351291)
bones/9/rotation = Quaternion(0.994319, 0.0202095, -0.0312668, 0.0997189)
bones/11/rotation = Quaternion(0.393204, -0.000694492, 0.000297126, 0.919451)
bones/13/rotation = Quaternion(-0.74009, 0.011843, 0.024358, 0.671962)
bones/15/position = Vector3(-0.131144, 0.977157, -0.0351291)
bones/15/rotation = Quaternion(0.975987, -0.00524444, 0.0276951, 0.215996)
bones/17/rotation = Quaternion(0.41958, 0.00314561, -0.00145412, 0.907712)
bones/19/rotation = Quaternion(-0.677426, -0.0281345, -0.00149649, 0.735051)
bones/21/position = Vector3(0.0251286, 1.44036, 0.0474137)
bones/21/rotation = Quaternion(-0.46932, -0.267709, -0.417628, 0.730519)
bones/22/position = Vector3(0.191593, 1.4794, -0.00923866)
bones/22/rotation = Quaternion(0.0197668, -0.164243, 0.975516, -0.144921)
bones/23/rotation = Quaternion(7.1093e-08, -0.0403403, 2.07269e-08, 0.999186)
bones/24/rotation = Quaternion(0.354444, -0.0404196, -0.0221276, 0.933941)
bones/46/position = Vector3(-0.0113635, 1.44036, 0.0474137)
bones/46/rotation = Quaternion(-0.468803, 0.266677, 0.417532, 0.731282)
bones/47/position = Vector3(-0.177709, 1.47954, -0.00948774)
bones/47/rotation = Quaternion(-0.00744272, -0.148237, 0.976085, 0.158837)
bones/48/rotation = Quaternion(-1.46507e-07, 0.0591718, -1.3974e-07, 0.998248)
bones/49/rotation = Quaternion(0.39551, 0.0593204, 0.0277605, 0.916124)
bones/71/position = Vector3(0.127191, 1.3616, -0.0243553)
bones/71/rotation = Quaternion(2.03481e-08, 0.597841, 0.801615, -4.58317e-08)
bones/72/position = Vector3(-0.113426, 1.3616, -0.0243553)
bones/72/rotation = Quaternion(2.03481e-08, 0.597841, 0.801615, -4.58316e-08)

[node name="Knight_02" parent="Rig/CharacterRig/GameRig/Skeleton3D" index="1"]
visible = false

[node name="Villager_01" parent="Rig/CharacterRig/GameRig/Skeleton3D" index="2"]
visible = true

[node name="RightHandBone" parent="Rig" index="2"]
transform = Transform3D(-0.962406, -0.270594, -0.023532, 0.220109, -0.827734, 0.516149, -0.159145, 0.491565, 0.856175, -0.351473, 1.01394, 0.0326189)

[node name="broken_sword" parent="Rig/RightHandBone/WeaponSlot" index="0" instance=ExtResource("6_aygwl")]

[node name="LeftHandBone" parent="Rig" index="3"]
transform = Transform3D(-0.970516, 0.239097, 0.0305111, -0.208084, -0.894985, 0.394591, 0.121653, 0.376608, 0.91835, 0.348401, 0.996406, -0.00542178)

[node name="PlayerDetectorAttack" type="ShapeCast3D" parent="Rig"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
shape = SubResource("CapsuleShape3D_ljmr7")
target_position = Vector3(0, 0, 0)
collision_mask = 4

[node name="PlayerDetectorPursue" type="ShapeCast3D" parent="Rig"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
shape = SubResource("CylinderShape3D_fwei0")
target_position = Vector3(0, 0, 0)
collision_mask = 4

[node name="AreaAttack" parent="Rig" instance=ExtResource("3_ljmr7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
collision_mask = 4

[connection signal="velocity_computed" from="NavigationAgent3D" to="." method="_on_navigation_agent_3d_velocity_computed"]
[connection signal="defeat" from="HealthComponent" to="." method="_on_health_component_defeat"]
[connection signal="heavy_attack" from="Rig" to="." method="_on_rig_heavy_attack"]

[editable path="Rig"]
[editable path="Rig/CharacterRig"]
