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.
HighGroundRoyaleNetcode/Assets/Scripts/Gameplay/GameStateManager.cs

30 lines
660 B
C#

using UnityEngine;
using System;
public class GameStateManager : MonoBehaviour
{
public static GameStateManager Instance { get; private set; }
public event Action<CursorState> OnStateChanged ;
CursorState currentState = CursorState.Default;
void Awake( ) {
if ( Instance ) {
Destroy( gameObject ) ;
return ;
}
Instance = this ;
}
public void ChangeState( CursorState newState ) {
if ( currentState == newState ) return ;
currentState = newState ;
OnStateChanged?.Invoke( newState ) ;
}
public CursorState GetCurrentState( ) => currentState ;
}