pause now is not mandatory

This commit is contained in:
Rendo 2025-07-17 20:57:18 +05:00
commit 5d4ae478dc
7 changed files with 31 additions and 8 deletions

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=15 format=3 uid="uid://bu0dh5ct387xu"]
[gd_scene load_steps=16 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="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="3_lsqv3"]
[ext_resource type="Script" uid="uid://1lkhoh43h86m" path="res://scripts/level/GameTimer.cs" id="4_8ajos"]
[ext_resource type="Script" uid="uid://84gvlkflxdhk" path="res://scripts/level/zombe_spawners/RowSpawner.cs" id="4_kn7hc"]
[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"]
@ -307,6 +308,10 @@ vertical_alignment = 1
[node name="CollisionShape2D" parent="GameOverZombie/LoseZone/Hitbox" index="0"]
shape = SubResource("WorldBoundaryShape2D_vbgdr")
[node name="Timer" parent="SunSpawner" index="0"]
autostart = false
script = ExtResource("4_8ajos")
[node name="RowSpawner" type="Node2D" parent="." index="14" node_paths=PackedStringArray("delayTimer", "runner")]
position = Vector2(837, 76)
script = ExtResource("4_kn7hc")
@ -337,6 +342,7 @@ fadeAnimation = NodePath("../GameOverScreen/AnimationPlayer")
[node name="CollisionShape2D" parent="Checkbox" index="0"]
shape = SubResource("WorldBoundaryShape2D_yw4uo")
[connection signal="OnLevelStateChanged" from="Data" to="SunSpawner/Timer" method="OnLevelStateChanged"]
[connection signal="OnLevelStateChanged" from="Data" to="ZombieLevelPrevewer" method="OnLevelStateChanged"]
[connection signal="FinalWaveInitiated" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["FW_Sequence"]]
[connection signal="HugeWaveApproachingCallback" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["HW_Sequence"]]

View file

@ -49,9 +49,9 @@ public partial class Entity : Node2D
public virtual void DisableBrain()
{
if (_player != null)
_player.ProcessMode = ProcessModeEnum.Always;
_player.ProcessMode = ProcessModeEnum.Pausable;
if (_tree != null)
_tree.ProcessMode = ProcessModeEnum.Always;
_tree.ProcessMode = ProcessModeEnum.Pausable;
ProcessMode = ProcessModeEnum.Disabled;
}

View file

@ -0,0 +1,17 @@
using Godot;
using Newlon.Components.Level;
public partial class GameTimer : Timer
{
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
{
if (state == RuntimeLevelData.LevelStates.Game)
{
Start();
}
else
{
Stop();
}
}
}

View file

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

View file

@ -29,6 +29,7 @@ public partial class LevelRunner : Node
public override void _Process(double delta)
{
if (RuntimeLevelData.Instance.GetLevelState() != RuntimeLevelData.LevelStates.Game) return;
if (waveIndex == resource.waves.Count - 1) return;
if (waveTimer.TimeLeft < approachNotificationTime && resource.waves[waveIndex + 1].isHugeWave && hugeWaveApproaching == false)
{

View file

@ -33,7 +33,6 @@ public partial class RuntimeLevelData : Node
public override void _Ready()
{
Instance = this;
GetTree().Paused = true;
Engine.TimeScale = 1.0;
SetLevelState(LevelStates.ChooseYourSeeds);
}

View file

@ -8,13 +8,12 @@ public partial class SunSpawner : Node
public int MinSun = 25;
[Export]
public int MaxSun = 25;
[Export]
private PackedScene SunScene;
public void Spawn()
{
float x = GD.Randf()*9*FieldParams.TileWidth;
float x = GD.Randf() * 9 * FieldParams.TileWidth;
uint y = GD.Randi() % 5;
var sun = SunScene.Instantiate<Sun>();
@ -23,7 +22,7 @@ public partial class SunSpawner : Node
sun.GlobalPosition = new Vector2(FieldParams.LeftFieldBoundary.X + x, -90);
var moveTween = CreateTween();
moveTween.TweenProperty(sun,"global_position", new Vector2(FieldParams.LeftFieldBoundary.X + x,
FieldParams.LeftFieldBoundary.Y + FieldParams.TileHeight * y + FieldParams.TileHeight/2.0f),9-y);
moveTween.TweenProperty(sun, "global_position", new Vector2(FieldParams.LeftFieldBoundary.X + x,
FieldParams.LeftFieldBoundary.Y + FieldParams.TileHeight * y + FieldParams.TileHeight / 2.0f), 9 - y);
}
}