Added cash counter

This commit is contained in:
2026-03-30 13:44:46 +01:00
parent 59b64a680f
commit 652df5ce01
8 changed files with 1016 additions and 11 deletions

View File

@@ -9,32 +9,38 @@ namespace Fruitomation
Building,
UpgradeMenu,
Paused,
None
Default
}
[CreateInstanceOnStart] public class GameStateController : MonoBehaviour
{
private static GameStateController Instance;
private GameState InternalState = GameState.None;
[SerializeField, InspectorReadOnly("Game State")] private GameState InternalState;
public static GameState State
{
get => Instance.InternalState;
set
{
Debug.Log($"Changing state from [{Instance.InternalState}] to [{value}]");
Instance.InternalState = value;
if (Instance.InternalState != value)
{
Debug.Log($"Changing state from [{Instance.InternalState}] to [{value}]");
Instance.InternalState = value;
}
}
}
public static bool Is(GameState state) => State == state;
private void Awake()
{
if (Instance is not null)
{
Debug.LogError($"Cannot have multiple instances of [GameStateController]");
Debug.LogError("Cannot have multiple instances of [GameStateController]");
return;
}
InternalState = GameState.Default;
Instance = this;
}
}