Fix game over

This commit is contained in:
2023-09-06 17:41:53 -07:00
parent 5acfb9300c
commit aac5fbd297
14 changed files with 301 additions and 72 deletions

View File

@@ -1,4 +1,5 @@
using Godot;
using Godot.Collections;
using System.Linq;
public partial class StageGUI : Control
@@ -16,7 +17,7 @@ public partial class StageGUI : Control
[Signal]
public delegate void OnPlayerGameOverEventHandler(Player player);
[Signal]
public delegate void OnGameOverEventHandler();
public delegate void OnGameOverEventHandler(Array<Player> players);
private GameManager _gameManager;
@@ -65,9 +66,9 @@ public partial class StageGUI : Control
EmitSignal(SignalName.OnPlayerGameOver, player);
}
if (_gameManager.Players.All(x => x.GameOver))
if (!_gameManager.IsGameOverScreenOn && _gameManager.Players.All(x => x.GameOver))
{
EmitSignal(SignalName.OnGameOver);
EmitSignal(SignalName.OnGameOver, new Array<Player>(_gameManager.Players));
}
}