mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 19:33:47 +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]
|
[Signal]
|
||||||
public delegate void GameStateChangeEventHandler(GameState state);
|
public delegate void GameStateChangeEventHandler(GameState state);
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void PlayerRespawnedEventHandler();
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
|
@ -77,6 +80,8 @@ public partial class GameManager : Node2D
|
||||||
_inventoryManager.ItemRemoved += (item, currentAmount) => _hud.RemoveInventoryItem(item, currentAmount);
|
_inventoryManager.ItemRemoved += (item, currentAmount) => _hud.RemoveInventoryItem(item, currentAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerRespawned += OnPlayerRespawned;
|
||||||
|
|
||||||
GameState = GameState.Playing;
|
GameState = GameState.Playing;
|
||||||
|
|
||||||
//_ = DelayPlayerSpawn();
|
//_ = DelayPlayerSpawn();
|
||||||
|
|
@ -84,6 +89,11 @@ public partial class GameManager : Node2D
|
||||||
CallDeferred(MethodName.DelayPlayerSpawn);
|
CallDeferred(MethodName.DelayPlayerSpawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerRespawned()
|
||||||
|
{
|
||||||
|
this.ClearBullets();
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyMapStartData(MapStartDataResource mapStartData)
|
public void ApplyMapStartData(MapStartDataResource mapStartData)
|
||||||
{
|
{
|
||||||
MapStartData = mapStartData;
|
MapStartData = mapStartData;
|
||||||
|
|
@ -326,6 +336,15 @@ public partial class GameManager : Node2D
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearBullets()
|
||||||
|
{
|
||||||
|
if (_bulletsContainer is null) return;
|
||||||
|
foreach (var node in _bulletsContainer.GetChildren())
|
||||||
|
{
|
||||||
|
node.QueueFree();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GameState
|
public enum GameState
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue