Initial field spawns

This commit is contained in:
Rendo 2025-07-18 03:36:49 +05:00
commit 12b7435d19
28 changed files with 197 additions and 98 deletions

View file

@ -120,10 +120,10 @@ locale/translations=PackedStringArray("res://translations/plants.en.translation"
[layer_names] [layer_names]
2d_physics/layer_1="Reserved" 2d_physics/layer_1="Reserved"
2d_physics/layer_2="Plants LD" 2d_physics/layer_2="Plants Dummy"
2d_physics/layer_3="Plants Full" 2d_physics/layer_3="Plants True"
2d_physics/layer_4="Zombies LD" 2d_physics/layer_4="Zombies Dummy"
2d_physics/layer_5="Zombies Full" 2d_physics/layer_5="Zombies True"
2d_physics/layer_7="FallLine" 2d_physics/layer_7="FallLine"
2d_physics/layer_8="FallParticles" 2d_physics/layer_8="FallParticles"

View file

@ -1,5 +1,6 @@
[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=30 format=3 uid="uid://ctbue7dex4umy"] [gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=31 format=3 uid="uid://ctbue7dex4umy"]
[ext_resource type="PackedScene" uid="uid://b5x35v3w2u8dx" path="res://scenes/entities/plants/potato_mine.tscn" id="1_5e1dl"]
[ext_resource type="Script" uid="uid://bximdujbkj2n4" path="res://addons/pvzadventure/AdventureLevelResource.cs" id="1_46lr8"] [ext_resource type="Script" uid="uid://bximdujbkj2n4" path="res://addons/pvzadventure/AdventureLevelResource.cs" id="1_46lr8"]
[ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="2_otfbt"] [ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="2_otfbt"]
[ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="3_cugtx"] [ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="3_cugtx"]
@ -130,4 +131,4 @@ wavePercentage = 0.5
standardWaveDelay = 15.0 standardWaveDelay = 15.0
initialWaveDelay = 20.0 initialWaveDelay = 20.0
waves = [SubResource("Resource_qsvr4"), SubResource("Resource_otfbt"), SubResource("Resource_nv3y4"), SubResource("Resource_mt5r8"), SubResource("Resource_kugcf"), SubResource("Resource_oyvhx"), SubResource("Resource_k4k25"), SubResource("Resource_oxbea"), SubResource("Resource_5cdj6")] waves = [SubResource("Resource_qsvr4"), SubResource("Resource_otfbt"), SubResource("Resource_nv3y4"), SubResource("Resource_mt5r8"), SubResource("Resource_kugcf"), SubResource("Resource_oyvhx"), SubResource("Resource_k4k25"), SubResource("Resource_oxbea"), SubResource("Resource_5cdj6")]
initialScenes = Array[PackedScene]([null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]) initialScenes = Array[PackedScene]([null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null])

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://cl5bsa2unhcl0"] [gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://ciewunnfalrbb"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_jrx81"] [ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_jrx81"]
[ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="1_tdg4d"] [ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="1_tdg4d"]

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://do7m0lfki5ere"] [gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://8edvnmwu4tyn"]
[ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="1_of51r"] [ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="1_of51r"]
[ext_resource type="PackedScene" uid="uid://k5aj2slxar7w" path="res://scenes/entities/plants/nerdus.tscn" id="2_0i6qf"] [ext_resource type="PackedScene" uid="uid://k5aj2slxar7w" path="res://scenes/entities/plants/nerdus.tscn" id="2_0i6qf"]

View file

@ -95,6 +95,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
size = Vector2(22, 32) size = Vector2(22, 32)
[node name="Aloe" instance=ExtResource("1_n25yi")] [node name="Aloe" instance=ExtResource("1_n25yi")]
internal_id = "aloe"
MaxHP = 30.0 MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -28,23 +28,6 @@ _data = {
&"RESET": SubResource("Animation_n1xkd") &"RESET": SubResource("Animation_n1xkd")
} }
[sub_resource type="Animation" id="Animation_ig0op"]
length = 0.666675
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13, 14]
}
[sub_resource type="Animation" id="Animation_d45iq"] [sub_resource type="Animation" id="Animation_d45iq"]
length = 0.833342 length = 0.833342
step = 0.0833333 step = 0.0833333
@ -75,6 +58,23 @@ tracks/1/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_ig0op"]
length = 0.666675
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13, 14]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n1xkd"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_n1xkd"]
_data = { _data = {
&"attack": SubResource("Animation_d45iq"), &"attack": SubResource("Animation_d45iq"),
@ -124,6 +124,7 @@ height = 48.0
size = Vector2(26, 600) size = Vector2(26, 600)
[node name="Cucumber" instance=ExtResource("1_65f4u")] [node name="Cucumber" instance=ExtResource("1_65f4u")]
internal_id = "cucumber"
MaxHP = 30.0 MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -60,6 +60,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
size = Vector2(32, 29) size = Vector2(32, 29)
[node name="Garlic" instance=ExtResource("1_5i0e6")] [node name="Garlic" instance=ExtResource("1_5i0e6")]
internal_id = "garlic"
MaxHP = 200.0 MaxHP = 200.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -26,57 +26,6 @@ _data = {
&"RESET": SubResource("Animation_ga4vy") &"RESET": SubResource("Animation_ga4vy")
} }
[sub_resource type="Animation" id="Animation_yxvnw"]
length = 1.16668
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667, 0.833333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5]
}
[sub_resource type="Animation" id="Animation_o12iv"]
length = 1.16668
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [7, 8, 9, 10, 11, 12, 13]
}
[sub_resource type="Animation" id="Animation_6e60l"]
length = 1.16668
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [14, 15, 16, 17, 18, 19, 20]
}
[sub_resource type="Animation" id="Animation_v7ffp"] [sub_resource type="Animation" id="Animation_v7ffp"]
length = 0.500008 length = 0.500008
step = 0.0833333 step = 0.0833333
@ -107,6 +56,36 @@ tracks/1/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_6a4q1"]
length = 0.500008
step = 0.0833333
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, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [35, 36, 37, 38, 39, 40]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Hurtbox")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.416667),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"ReturnAllDamage"
}]
}
[sub_resource type="Animation" id="Animation_rb7ob"] [sub_resource type="Animation" id="Animation_rb7ob"]
length = 0.500008 length = 0.500008
step = 0.0833333 step = 0.0833333
@ -137,8 +116,9 @@ tracks/1/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_6a4q1"] [sub_resource type="Animation" id="Animation_yxvnw"]
length = 0.500008 length = 1.16668
loop_mode = 2
step = 0.0833333 step = 0.0833333
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
@ -147,24 +127,44 @@ tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667), "times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1, "update": 1,
"values": [35, 36, 37, 38, 39, 40] "values": [0, 1, 2, 3, 4, 5]
} }
tracks/1/type = "method"
tracks/1/imported = false [sub_resource type="Animation" id="Animation_6e60l"]
tracks/1/enabled = true length = 1.16668
tracks/1/path = NodePath("Hurtbox") loop_mode = 2
tracks/1/interp = 1 step = 0.0833333
tracks/1/loop_wrap = true tracks/0/type = "value"
tracks/1/keys = { tracks/0/imported = false
"times": PackedFloat32Array(0.416667), tracks/0/enabled = true
"transitions": PackedFloat32Array(1), tracks/0/path = NodePath("Sprite2D:frame")
"values": [{ tracks/0/interp = 1
"args": [], tracks/0/loop_wrap = true
"method": &"ReturnAllDamage" tracks/0/keys = {
}] "times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [14, 15, 16, 17, 18, 19, 20]
}
[sub_resource type="Animation" id="Animation_o12iv"]
length = 1.16668
loop_mode = 2
step = 0.0833333
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, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [7, 8, 9, 10, 11, 12, 13]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pddnl"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_pddnl"]
@ -252,6 +252,7 @@ radius = 24.0
size = Vector2(73, 48) size = Vector2(73, 48)
[node name="Nerdus" instance=ExtResource("1_8ui1h")] [node name="Nerdus" instance=ExtResource("1_8ui1h")]
internal_id = "nerdus"
MaxHP = 200.0 MaxHP = 200.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -73,6 +73,7 @@ resource_local_to_scene = true
size = Vector2(20, 44) size = Vector2(20, 44)
[node name="Peashooter" instance=ExtResource("1_pyk3o")] [node name="Peashooter" instance=ExtResource("1_pyk3o")]
internal_id = "peashooter"
MaxHP = 30.0 MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -78,6 +78,7 @@ size = Vector2(15, 27)
size = Vector2(22, 19) size = Vector2(22, 19)
[node name="Potato mine" instance=ExtResource("1_dj7ul")] [node name="Potato mine" instance=ExtResource("1_dj7ul")]
internal_id = "potatomine"
MaxHP = 20.0 MaxHP = 20.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]

View file

@ -63,6 +63,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
resource_local_to_scene = true resource_local_to_scene = true
[node name="Snowpea" instance=ExtResource("1_lp85e")] [node name="Snowpea" instance=ExtResource("1_lp85e")]
internal_id = "snowpea"
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_ytrm0") texture = ExtResource("2_ytrm0")

View file

@ -36,6 +36,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
size = Vector2(49, 38) size = Vector2(49, 38)
[node name="Spikeweed" instance=ExtResource("1_vmbvr")] [node name="Spikeweed" instance=ExtResource("1_vmbvr")]
internal_id = "spikeweed"
MaxHP = 30.0 MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]
@ -54,9 +55,8 @@ tree_root = SubResource("AnimationNodeBlendTree_63okc")
parameters/TimeScale/scale = 1.0 parameters/TimeScale/scale = 1.0
parameters/Tree/blend_position = 0 parameters/Tree/blend_position = 0
[node name="Behaviour" type="Node" parent="." index="3" node_paths=PackedStringArray("_tree")] [node name="Behaviour" type="Node" parent="." index="3"]
script = ExtResource("3_uhpn7") script = ExtResource("3_uhpn7")
_tree = NodePath("../AnimationTree")
[node name="Hitbox" parent="." index="4"] [node name="Hitbox" parent="." index="4"]
collision_layer = 4 collision_layer = 4

View file

@ -66,12 +66,14 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
size = Vector2(26, 48) size = Vector2(26, 48)
[node name="Sunflower" instance=ExtResource("1_bikjn")] [node name="Sunflower" instance=ExtResource("1_bikjn")]
internal_id = "sunflower"
MaxHP = 30.0 MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_fwcda") texture = ExtResource("2_fwcda")
hframes = 9 hframes = 9
vframes = 2 vframes = 2
frame = 3
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
libraries = { libraries = {

View file

@ -135,6 +135,7 @@ resource_local_to_scene = true
resource_local_to_scene = true resource_local_to_scene = true
[node name="Threepeater" instance=ExtResource("1_muntu")] [node name="Threepeater" instance=ExtResource("1_muntu")]
internal_id = "threepeater"
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]
position = Vector2(6, -13) position = Vector2(6, -13)

View file

@ -38,13 +38,14 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
size = Vector2(33, 46) size = Vector2(33, 46)
[node name="Wallnut" instance=ExtResource("1_fluxn")] [node name="Wallnut" instance=ExtResource("1_fluxn")]
internal_id = "wallnut"
MaxHP = 600.0 MaxHP = 600.0
[node name="Sprite2D" parent="." index="0"] [node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_o5tda") texture = ExtResource("2_o5tda")
hframes = 12 hframes = 12
vframes = 3 vframes = 3
frame = 9 frame = 10
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
libraries = { libraries = {

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://bu0dh5ct387xu"] [gd_scene load_steps=17 format=3 uid="uid://bu0dh5ct387xu"]
[ext_resource type="PackedScene" uid="uid://dd3yegl1xo44m" path="res://scenes/templates/level_template.tscn" id="1_vdv3d"] [ext_resource type="PackedScene" uid="uid://dd3yegl1xo44m" path="res://scenes/templates/level_template.tscn" id="1_vdv3d"]
[ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="3_lsqv3"] [ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="3_lsqv3"]
@ -7,6 +7,7 @@
[ext_resource type="Script" uid="uid://puqxp2xeg1r2" path="res://scripts/level/LevelRunner.cs" id="5_vbgdr"] [ext_resource type="Script" uid="uid://puqxp2xeg1r2" path="res://scripts/level/LevelRunner.cs" id="5_vbgdr"]
[ext_resource type="PackedScene" uid="uid://c668qnmmpli5r" path="res://scenes/gui/wave_progress.tscn" id="6_yw4uo"] [ext_resource type="PackedScene" uid="uid://c668qnmmpli5r" path="res://scenes/gui/wave_progress.tscn" id="6_yw4uo"]
[ext_resource type="Script" uid="uid://bc3s06ejbotma" path="res://scripts/gui/ZombieLevelPreviewer.cs" id="7_8ajos"] [ext_resource type="Script" uid="uid://bc3s06ejbotma" path="res://scripts/gui/ZombieLevelPreviewer.cs" id="7_8ajos"]
[ext_resource type="Script" uid="uid://b31mnk4enldc4" path="res://scripts/level/InitialPackedSceneSpawner.cs" id="8_pqj5f"]
[sub_resource type="Animation" id="Animation_vbgdr"] [sub_resource type="Animation" id="Animation_vbgdr"]
resource_name = "CYS_Sequence" resource_name = "CYS_Sequence"
@ -342,8 +343,12 @@ fadeAnimation = NodePath("../GameOverScreen/AnimationPlayer")
[node name="CollisionShape2D" parent="Checkbox" index="0"] [node name="CollisionShape2D" parent="Checkbox" index="0"]
shape = SubResource("WorldBoundaryShape2D_yw4uo") shape = SubResource("WorldBoundaryShape2D_yw4uo")
[node name="InitialSpawner" type="Node" parent="." index="18"]
script = ExtResource("8_pqj5f")
[connection signal="OnLevelStateChanged" from="Data" to="SunSpawner/Timer" method="OnLevelStateChanged"] [connection signal="OnLevelStateChanged" from="Data" to="SunSpawner/Timer" method="OnLevelStateChanged"]
[connection signal="OnLevelStateChanged" from="Data" to="ZombieLevelPrevewer" method="OnLevelStateChanged"] [connection signal="OnLevelStateChanged" from="Data" to="ZombieLevelPrevewer" method="OnLevelStateChanged"]
[connection signal="OnLevelStateChanged" from="Data" to="InitialSpawner" method="OnLevelStateChanged"]
[connection signal="FinalWaveInitiated" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["FW_Sequence"]] [connection signal="FinalWaveInitiated" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["FW_Sequence"]]
[connection signal="HugeWaveApproachingCallback" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["HW_Sequence"]] [connection signal="HugeWaveApproachingCallback" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["HW_Sequence"]]
[connection signal="HugeWaveInitiated" from="LevelRunner" to="GUI/WaveProgress" method="OnHugeWaveApproached"] [connection signal="HugeWaveInitiated" from="LevelRunner" to="GUI/WaveProgress" method="OnHugeWaveApproached"]

View file

@ -0,0 +1,19 @@
using Godot;
using Newlon.Components;
using Newlon.Components.Level;
[GlobalClass]
public partial class LevelStateBrainDisabler : Node
{
public override void _Ready()
{
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
}
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
{
if (state == RuntimeLevelData.LevelStates.Game)
{
GetParent<Entity>().EnableBrain();
}
}
}

View file

@ -0,0 +1 @@
uid://ldjyga3rbqoj

View file

@ -0,0 +1,59 @@
using Godot;
using Newlon.Components;
using Newlon.Components.Level;
using Newlon.Components.Plants;
using Newlon.Components.Zombies;
public partial class InitialPackedSceneSpawner : Node
{
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
{
if (state == RuntimeLevelData.LevelStates.ChooseYourSeeds)
{
for (int i = 0; i < RuntimeLevelData.LevelResource.initialScenes.Count; i++)
{
var packed = RuntimeLevelData.LevelResource.initialScenes[i];
if (packed == null) continue;
var scene = packed.Instantiate();
if (scene is Node2D node)
{
int x = i % 9;
int y = i / 9;
var position = FieldParams.LeftFieldBoundary + new Vector2((x + 0.5f) * FieldParams.TileWidth, (y + 0.5f) * FieldParams.TileHeight);
if (node is Entity entity)
{
var brainDisabler = new LevelStateBrainDisabler();
entity.DisableBrain();
entity.AddChild(brainDisabler);
if (entity is RuntimeZombieData)
{
PoolContainer.Instance.Structures.AddChild(node);
node.GlobalPosition = position;
}
else if (entity is RuntimePlantData plant)
{
PoolContainer.Instance.Plants.AddChild(plant);
node.GlobalPosition = position;
PoolContainer.Instance.EntityField[GameRegistry.GetPlantByName(plant.internal_id).Layer].Add(plant.GlobalPosition, plant);
}
else
{
PoolContainer.Instance.Structures.AddChild(entity);
node.GlobalPosition = position;
PoolContainer.Instance.EntityField[1].Add(entity.GlobalPosition, entity);
}
}
else
{
PoolContainer.Instance.Structures.AddChild(node);
}
}
}
}
}
}

View file

@ -0,0 +1 @@
uid://b31mnk4enldc4

View file

@ -24,7 +24,7 @@ public partial class PoolContainer : Node2D
public static PoolContainer Instance { get; private set; } public static PoolContainer Instance { get; private set; }
public Dictionary<Vector2, Entity>[] EntityField = { new(), new(), new() }; public Dictionary<Vector2, Entity>[] EntityField = { new(), new(), new() };
public override void _Ready() public override void _EnterTree()
{ {
Instance = this; Instance = this;
} }

View file

@ -9,6 +9,8 @@ namespace Newlon.Components.Plants;
public partial class RuntimePlantData : Entity public partial class RuntimePlantData : Entity
{ {
[Export]
public string internal_id;
public int Line { get; set; } public int Line { get; set; }
public PlantResource Resource; public PlantResource Resource;
private AudioStream eatenSound = ResourceLoader.Load<AudioStream>("res://assets/audio/sfx/gulp.mp3"); private AudioStream eatenSound = ResourceLoader.Load<AudioStream>("res://assets/audio/sfx/gulp.mp3");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.