// Final state IEnumerator Celebrate() { onCelebrationEvent.Invoke(); Debug.Log("Celebrating"); respondState = RespondToPlayerState.Celebration; yield break; }
IEnumerator Idle() { onIdleEvent.Invoke(); Debug.Log("Start Idle"); respondState = RespondToPlayerState.IsIdle; while (platformCount == gm.playerOrder.Count) { Debug.Log("Idle"); platformCount = gm.playerOrder.Count; yield return(new WaitForFixedUpdate()); } if (gm.playerOrder.Count == gm.platformOrder.Count) { currentStateCoroutine = StartCoroutine("Celebrate"); } else if (gm.playerOrder.Count == 0) { platformCount = 0; currentStateCoroutine = StartCoroutine("Idle"); } else if ((platformCount + 1) == gm.playerOrder.Count) { platformCount = gm.playerOrder.Count; currentStateCoroutine = StartCoroutine("Cheer"); } yield return(null); }
IEnumerator Cheer() { onCheerEvent.Invoke(); respondState = RespondToPlayerState.Cheering; Debug.Log("Start Cheering"); yield return(new WaitForSeconds(cheerDuration)); currentStateCoroutine = StartCoroutine("Idle"); }
// All the states for the FSM with their Unity Events IEnumerator PlayMusic() { Debug.Log("Start Play Music"); onPlayMusicEvent.Invoke(); respondState = RespondToPlayerState.PlayingMusic; while (gm.isPlayingAudio) { Debug.Log("Playing Audio"); yield return(new WaitForFixedUpdate()); } currentStateCoroutine = StartCoroutine("Idle"); yield return(null); }