//Changes the current game state public void SetState(System.Type newStateType) { if (currentState != null) { currentState.OnDeactivate(); } currentState = GetComponentInChildren(newStateType) as _StatesBase; if (currentState != null) { currentState.OnActivate(); } }
//Changes the current game state public void SetState(System.Type newStateType) { Debug.Log_cyan($"SetState > {newStateType}", this, 2); if (currentState != null) { currentState.OnDeactivate(); } currentState = GetComponentInChildren(newStateType) as _StatesBase; if (currentState != null) { currentState.OnActivate(); } }