[gd_scene load_steps=16 format=3 uid="uid://qq0cw8xtcoj3"]

[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_5i0e6"]
[ext_resource type="Texture2D" uid="uid://dff73m8ahamaa" path="res://assets/sprites/atlases/plants/garlic.png" id="2_w2jbi"]
[ext_resource type="AnimationLibrary" uid="uid://cjl81f61gdlvi" path="res://resources/animations/plants/garlic.res" id="3_jkb3q"]
[ext_resource type="Script" uid="uid://btkmd86pn828y" path="res://scripts/plants/behaviours/HpBasedBehaviour.cs" id="4_bv44h"]
[ext_resource type="Script" uid="uid://bmtukcq10m8wo" path="res://scripts/plants/ReturnEffect.cs" id="5_oob20"]
[ext_resource type="Resource" uid="uid://dsg1vjx76ifgu" path="res://resources/effects/GarlicEffect.tres" id="6_gho1l"]

[sub_resource type="Animation" id="Animation_k0cex"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D: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="AnimationLibrary" id="AnimationLibrary_v4l78"]
_data = {
&"RESET": SubResource("Animation_k0cex")
}

[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_2d3xk"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_mdv0r"]
animation = &"garlic/full_hp"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_j5xqj"]
animation = &"garlic/half_hp"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tlgpl"]
animation = &"garlic/low_hp"

[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_8mvpm"]
blend_point_0/node = SubResource("AnimationNodeAnimation_mdv0r")
blend_point_0/pos = 1.0
blend_point_1/node = SubResource("AnimationNodeAnimation_j5xqj")
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_tlgpl")
blend_point_2/pos = 0.0
min_space = 0.0
blend_mode = 1

[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_2o7sr"]
graph_offset = Vector2(-389, 166)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_2d3xk")
nodes/TimeScale/position = Vector2(100, 160)
nodes/Tree/node = SubResource("AnimationNodeBlendSpace1D_8mvpm")
nodes/Tree/position = Vector2(-160, 200)
node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_thlvs"]
size = Vector2(32, 29)

[node name="Garlic" instance=ExtResource("1_5i0e6")]
MaxHP = 200.0

[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_w2jbi")
hframes = 8
vframes = 3

[node name="AnimationPlayer" parent="." index="1"]
libraries = {
&"": SubResource("AnimationLibrary_v4l78"),
&"garlic": ExtResource("3_jkb3q")
}

[node name="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeBlendTree_2o7sr")
parameters/TimeScale/scale = 1.0
parameters/Tree/blend_position = 1.0

[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(1, 11.5)
shape = SubResource("RectangleShape2D_thlvs")

[node name="Behaviour" type="Node" parent="." index="4"]
script = ExtResource("4_bv44h")
parameters = Array[String](["parameters/Tree/blend_position"])

[node name="ReturnEffect" type="Node" parent="." index="5"]
script = ExtResource("5_oob20")
_effectToReturn = ExtResource("6_gho1l")

[connection signal="OnHPChanged" from="." to="Behaviour" method="OnHPChanged"]
[connection signal="OnHPChanged" from="." to="ReturnEffect" method="OnDamageRecieved"]
