mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:55:35 +00:00
Clear bullets on respawn
This commit is contained in:
parent
959701be08
commit
968dec6293
1 changed files with 19 additions and 0 deletions
|
|
@ -48,6 +48,9 @@ public partial class GameManager : Node2D
|
|||
[Signal]
|
||||
public delegate void GameStateChangeEventHandler(GameState state);
|
||||
|
||||
[Signal]
|
||||
public delegate void PlayerRespawnedEventHandler();
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -77,6 +80,8 @@ public partial class GameManager : Node2D
|
|||
_inventoryManager.ItemRemoved += (item, currentAmount) => _hud.RemoveInventoryItem(item, currentAmount);
|
||||
}
|
||||
|
||||
PlayerRespawned += OnPlayerRespawned;
|
||||
|
||||
GameState = GameState.Playing;
|
||||
|
||||
//_ = DelayPlayerSpawn();
|
||||
|
|
@ -84,6 +89,11 @@ public partial class GameManager : Node2D
|
|||
CallDeferred(MethodName.DelayPlayerSpawn);
|
||||
}
|
||||
|
||||
private void OnPlayerRespawned()
|
||||
{
|
||||
this.ClearBullets();
|
||||
}
|
||||
|
||||
public void ApplyMapStartData(MapStartDataResource mapStartData)
|
||||
{
|
||||
MapStartData = mapStartData;
|
||||
|
|
@ -326,6 +336,15 @@ public partial class GameManager : Node2D
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearBullets()
|
||||
{
|
||||
if (_bulletsContainer is null) return;
|
||||
foreach (var node in _bulletsContainer.GetChildren())
|
||||
{
|
||||
node.QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum GameState
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue