You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
757 B
C#
38 lines
757 B
C#
using UnityEngine;
|
|
using System;
|
|
|
|
public class GameStateManager : MonoBehaviour
|
|
{
|
|
public static GameStateManager Instance { get; private set; }
|
|
|
|
public event Action<CursorState> OnStateChanged;
|
|
|
|
private CursorState currentState = CursorState.Default;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject); // Prevent duplicates
|
|
}
|
|
}
|
|
|
|
public void ChangeState(CursorState newState)
|
|
{
|
|
if (currentState != newState)
|
|
{
|
|
currentState = newState;
|
|
OnStateChanged?.Invoke(newState);
|
|
}
|
|
}
|
|
|
|
public CursorState GetCurrentState()
|
|
{
|
|
return currentState;
|
|
}
|
|
}
|