Added GameState controller

This commit is contained in:
2026-03-30 13:13:14 +01:00
parent fb63e2dd39
commit 59b64a680f
3 changed files with 57 additions and 5 deletions

View File

@@ -0,0 +1,41 @@
using PashaBibko.Pacore.Attributes;
using UnityEngine;
namespace Fruitomation
{
public enum GameState
{
Simulation,
Building,
UpgradeMenu,
Paused,
None
}
[CreateInstanceOnStart] public class GameStateController : MonoBehaviour
{
private static GameStateController Instance;
private GameState InternalState = GameState.None;
public static GameState State
{
get => Instance.InternalState;
set
{
Debug.Log($"Changing state from [{Instance.InternalState}] to [{value}]");
Instance.InternalState = value;
}
}
private void Awake()
{
if (Instance is not null)
{
Debug.LogError($"Cannot have multiple instances of [GameStateController]");
return;
}
Instance = this;
}
}
}