public void ChangeState(UIState state) { //We want to disable what the state is doing before changing to a new state so we get a clean template for the UI currentState?.BeforeStateChange(); currentState = state; currentState.DisplayState(); Debug.Log("Current state: " + currentState.ToString()); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } references.AddRange(GetComponents <StateReferences>()); currentState = new LoginState(this); currentState.DisplayState(); }