[gd_scene load_steps=41 format=3 uid="uid://dhamcei7tfta8"]

[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_msit5"]
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_pkari"]
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_2dbgx"]
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_47f2d"]
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_iphm1"]
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="6_6516i"]
[ext_resource type="Script" path="res://State/Thinker/CenturionAttackState.cs" id="7_n2slg"]
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="8_5neew"]
[ext_resource type="Script" path="res://Utils/AnimationManager.cs" id="9_fgnr2"]
[ext_resource type="Animation" uid="uid://8e8r3y1imvsx" path="res://Assets/Animations/stun.res" id="10_1erll"]
[ext_resource type="Material" uid="uid://bat28samf7ukd" path="res://Assets/Sprites/Particles/NPCDamageProcessMaterial.tres" id="11_p7yev"]
[ext_resource type="Texture2D" uid="uid://bd8l8kafb42dt" path="res://Assets/Sprites/Particles/circle.png" id="12_t3nnt"]
[ext_resource type="Material" uid="uid://2tsvsp45elru" path="res://Assets/Sprites/Particles/NPCDeathParticles.tres" id="13_nm3wd"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="14_o5rd3"]
[ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="15_8yg1g"]
[ext_resource type="Texture2D" uid="uid://cfyd6sv4yeplt" path="res://Assets/Sprites/Characters/doc-centurion.png" id="16_6uxxp"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="17_6fh5y"]
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="18_7l8tj"]
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="19_xol7n"]

[sub_resource type="ShaderMaterial" id="ShaderMaterial_2fq6c"]
resource_local_to_scene = true
shader = ExtResource("1_msit5")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0

[sub_resource type="Animation" id="Animation_rqtrh"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}

[sub_resource type="Animation" id="Animation_qws2q"]
resource_name = "idle"
length = 0.8
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}

[sub_resource type="Animation" id="Animation_dwyme"]
resource_name = "move"
length = 0.6
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4, 5, 6]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_uqsue"]
_data = {
"RESET": SubResource("Animation_rqtrh"),
"idle": SubResource("Animation_qws2q"),
"move": SubResource("Animation_dwyme")
}

[sub_resource type="Animation" id="Animation_adxyh"]
resource_local_to_scene = true
length = 0.001

[sub_resource type="AnimationLibrary" id="AnimationLibrary_sxq14"]
_data = {
"RESET": SubResource("Animation_adxyh")
}

[sub_resource type="Animation" id="Animation_k6l16"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Effects/DeathParticles:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Effects/HurtParticles:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}

[sub_resource type="Animation" id="Animation_lhc4c"]
resource_name = "death"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Effects/DeathParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}

[sub_resource type="Animation" id="Animation_0vgmg"]
resource_local_to_scene = true
resource_name = "hurt"
length = 0.2
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2),
"transitions": PackedFloat32Array(4, 4, 4, 4),
"update": 0,
"values": [1.0, 0.0, 1.0, 0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Effects/HurtParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Effects/HurtParticles")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"restart"
}]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_rc55s"]
_data = {
"RESET": SubResource("Animation_k6l16"),
"death": SubResource("Animation_lhc4c"),
"hurt": SubResource("Animation_0vgmg")
}

[sub_resource type="Animation" id="Animation_7j54f"]
length = 0.001

[sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"]
_data = {
"RESET": SubResource("Animation_7j54f"),
"stun": ExtResource("10_1erll")
}

[sub_resource type="CanvasTexture" id="CanvasTexture_pited"]
diffuse_texture = ExtResource("14_o5rd3")

[sub_resource type="Gradient" id="Gradient_b2o0f"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)

[sub_resource type="GradientTexture1D" id="GradientTexture1D_iyaih"]
gradient = SubResource("Gradient_b2o0f")

[sub_resource type="Curve" id="Curve_30p4b"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0]
point_count = 3

[sub_resource type="CurveTexture" id="CurveTexture_5uulw"]
curve = SubResource("Curve_30p4b")

[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qdhau"]
particle_flag_disable_z = true
spread = 180.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 32.0
initial_velocity_max = 32.0
angular_velocity_min = 90.0
angular_velocity_max = 90.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
linear_accel_min = -64.0
linear_accel_max = -32.0
tangential_accel_min = 8.0
tangential_accel_max = 8.0
scale_min = 0.13
scale_max = 0.25
scale_curve = SubResource("CurveTexture_5uulw")
color = Color(1, 0, 0, 1)
color_ramp = SubResource("GradientTexture1D_iyaih")

[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
size = Vector2(12, 8)

[sub_resource type="RectangleShape2D" id="RectangleShape2D_1gjgc"]
size = Vector2(12, 16)

[node name="Centurion" type="CharacterBody2D" node_paths=PackedStringArray("DefaultSelectedItem", "ThinkerStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
y_sort_enabled = true
texture_filter = 3
material = SubResource("ShaderMaterial_2fq6c")
collision_layer = 6
collision_mask = 17
script = ExtResource("2_pkari")
DefaultSelectedItem = NodePath("Inventory/Sword")
ThinkerStateMachine = NodePath("ThinkerStateMachine")
Speed = 40.0
Mass = 2.0
Health = 80.0
Sprite = NodePath("Sprites/Node2D/Character")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
Hurtbox = NodePath("Hurtbox")

[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
script = ExtResource("3_2dbgx")
InitialState = NodePath("Idle")
Character = NodePath("..")

[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "Character")]
script = ExtResource("4_47f2d")
MoveState = NodePath("../Move")
Character = NodePath("../..")

[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")]
script = ExtResource("5_iphm1")
IdleState = NodePath("../Idle")
Character = NodePath("../..")

[node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("6_6516i")
InitialState = NodePath("Idle")

[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("NavigationAgent", "PassiveState", "PursueState", "NPC")]
script = ExtResource("7_n2slg")
FollowTeammate = true
NavigationAgent = NodePath("../../NavigationAgent2D")
PathfindingDistance = 32.0
PreferredWeightDistance = 24.0
MaxDistanceToTarget = 128.0
UseItemDistance = 48.0
PassiveState = NodePath("../Idle")
PursueState = NodePath("../Idle")
NPC = NodePath("../..")

[node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")]
script = ExtResource("8_5neew")
PursueState = NodePath("../Attack")
MinTargetDistance = 24.0
PursueOnLineOfSight = true
MinLineOfSightDistance = 256.0
ShouldReturnToOriginalPosition = true
NavigationAgent = NodePath("../../NavigationAgent2D")
NPC = NodePath("../..")

[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
target_desired_distance = 16.0
debug_enabled = true

[node name="Animations" type="Node" parent="."]
script = ExtResource("9_fgnr2")

[node name="Movement" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_uqsue")
}

[node name="Attack" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_sxq14")
}

[node name="Hurt" type="AnimationPlayer" parent="Animations"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_rc55s")
}

[node name="Stun" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_kks2p")
}

[node name="Effects" type="Node2D" parent="."]

[node name="HurtParticles" type="GPUParticles2D" parent="Effects"]
position = Vector2(0, -8)
emitting = false
process_material = ExtResource("11_p7yev")
texture = ExtResource("12_t3nnt")
lifetime = 0.4
one_shot = true
explosiveness = 1.0

[node name="DeathParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 32
process_material = ExtResource("13_nm3wd")
texture = SubResource("CanvasTexture_pited")
lifetime = 2.0
one_shot = true
preprocess = 0.1
explosiveness = 0.9

[node name="SpawnParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 24
process_material = SubResource("ParticleProcessMaterial_qdhau")
texture = ExtResource("14_o5rd3")

[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("15_8yg1g")

[node name="Sprites" type="Node2D" parent="."]
y_sort_enabled = true
use_parent_material = true
position = Vector2(-0.5, 0)
rotation = 6.28319

[node name="Node2D" type="Node2D" parent="Sprites"]
use_parent_material = true

[node name="Character" type="Sprite2D" parent="Sprites/Node2D"]
use_parent_material = true
texture = ExtResource("16_6uxxp")
offset = Vector2(0, -12)
hframes = 7

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -4)
shape = SubResource("RectangleShape2D_bfqew")

[node name="Inventory" type="Node2D" parent="."]
y_sort_enabled = true
position = Vector2(0, -4)
script = ExtResource("17_6fh5y")

[node name="Sword" parent="Inventory" instance=ExtResource("18_7l8tj")]

[node name="Hurtbox" parent="." instance=ExtResource("19_xol7n")]

[node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_1gjgc")

[editable path="Hurtbox"]
