// Override: FSMState::onLeave() public override void onLeave() { // Call parent base.onLeave(); // Kill timer if (m_timer != null) { m_timer.Stop(); m_timer = null; } // Delete on-screen text if (m_currentOnScreenTextObject != null) { GameObject.Destroy(m_currentOnScreenTextObject.gameObject); m_currentOnScreenTextObject = null; } // Unregister event callback DialogTextScript.AnswerClicked -= onChoiceClicked; // Delete choices if (m_window != null) { m_window.removeAnswers(); } // Close window? if (m_closeDialogWindowOnLeave == true && m_window != null) { m_window.closeDialogWindow(); } // Unblock the player movement? if (m_blockPlayerMovement == true) { Game.Instance.Player.blockMovement(false); } }
// Override: FSMTransition::setTargetFSMState public override void setTargetFSMState() { // Local variables DialogueWindowScript window = null; // Close window? if (m_closeDialogWindowOnLeave == true) { // Get window handle window = GameObject.Find("Dialog").GetComponent <DialogueWindowScript>(); if (window == null) { Debug.LogError("Dialog window has not been found!"); return; } window.closeDialogWindow(); } // Call parent base.setTargetFSMState(); }