pause now is not mandatory
This commit is contained in:
parent
f65cb11474
commit
5d4ae478dc
7 changed files with 31 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
17
scripts/level/GameTimer.cs
Normal file
17
scripts/level/GameTimer.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
scripts/level/GameTimer.cs.uid
Normal file
1
scripts/level/GameTimer.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://1lkhoh43h86m
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue