mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Global state singleton
This commit is contained in:
parent
a7f4f4eb28
commit
52d5adebcb
7 changed files with 73 additions and 5 deletions
|
|
@ -8,6 +8,7 @@ using Godot.Collections;
|
|||
|
||||
public partial class GameManager : Node2D
|
||||
{
|
||||
public static GameManager Instance { get; private set;}
|
||||
private Hud _hud;
|
||||
|
||||
private PlayerMovement _player;
|
||||
|
|
@ -30,6 +31,8 @@ public partial class GameManager : Node2D
|
|||
|
||||
private InventoryManager _inventoryManager { get; set; }
|
||||
|
||||
public MapStartData MapStartData { get; set; }
|
||||
|
||||
//private AlarmManager _alarmManager { get; set; }
|
||||
|
||||
//public InventoryManager Inventory => _inventoryManager;
|
||||
|
|
@ -45,6 +48,8 @@ public partial class GameManager : Node2D
|
|||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
_hud = GetNodeOrNull<Hud>("HUD");
|
||||
if (_hud == null) GD.Print("No HUD in scene.");
|
||||
|
||||
|
|
@ -73,7 +78,7 @@ public partial class GameManager : Node2D
|
|||
|
||||
//_ = DelayPlayerSpawn();
|
||||
|
||||
CallDeferred(nameof(DelayPlayerSpawn));
|
||||
CallDeferred(MethodName.DelayPlayerSpawn);
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue