/// <summary> /// Transition to another menu /// </summary> /// <param name="go">Menu to transition to, or null to remove menu</param> public void TransitionTo(aGameState go) { // Notify new menu that we are switching, if no new menu, deactive the other if (go != null) { go.OnTransitionTo(); } else if (_CurrentState != null) { _CurrentState.OnTransitionFrom(); _CurrentState.OnDeactivate(); _CurrentState = null; } // Transition from previous if needed if (_CurrentState != null) { _CurrentState.OnTransitionFrom(); } // Set active go.OnActive(); // Set current _CurrentState = go; }
/// <summary> /// Honestly dont know what this does, i didn't write it. /// </summary> void Start() { // Make sure that SOV folder exists if (!System.IO.Directory.Exists(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\SOV\\")) { System.IO.Directory.CreateDirectory(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\SOV\\"); } if (DefaultState != null) { //_CurrentMenu = Instantiate(DefaultMenu, this.transform) as GameObject; _CurrentState = DefaultState;//Instantiate<aGameState>(DefaultState); // Determine if we need to resize _CurrentState.transform.parent = this.transform; // Transition to _CurrentState.OnTransitionTo(); // Set active _CurrentState.OnActive(); } }