Files
Fruitomation/Assets/Scripts/GameStateController.cs
2026-03-30 13:13:14 +01:00

42 lines
957 B
C#

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;
}
}
}