/// <summary> /// Display main menu in the /// game scene and put the focus in /// the play button. /// </summary> /// <returns>IEnumerator</returns> public IEnumerator DisplayMainMenu() { // display menu component. Utils.instance.TriggerAnimation(animation, "DisplayMenu"); isDisplayed = true; yield return(new WaitForSeconds(.5f)); // set the navigation focus in the play button. playButton.onFocus(); }
/// <summary> /// Selectable button has /// the game cursor. /// </summary> /// <returns>IEnumerator</returns> private void ButtonOnFocus() { float toWait = 2f; // set button new status. onFocus = true; // play sound effect and trigger animations. audio.Play(); buttonWrapper.onFocus(); // yield return new WaitForSeconds( toWait ); // Utils.instance.TriggerAnimation( animation, "ButonInFocus", true ); // check if the button has lost the focus during the time the coroutine was being executed. if (!onFocus) { animation.Stop(); } }