/// Start of the Resolve state /// private void EnterStateResolve() { // Update moves SetMovesLeft(m_movesLeft - 1); // Pop the tiles m_coroutine = GlobalDirector.ExecuteCoroutine(StaggerTilesPop(() => { m_coroutine = GlobalDirector.ExecuteCoroutine(StaggerReplaceTiles(() => { if (IsLevelCompleted() == true) { // Level success m_fsm.ExecuteAction(k_actionWin); } else if (m_movesLeft > 0) { m_fsm.ExecuteAction(k_actionIdle); } else if (IsLevelCompleted() == true) { // Level success m_fsm.ExecuteAction(k_actionWin); } else { // Level fail m_fsm.ExecuteAction(k_actionLose); } })); })); }
/// Start of the Load state /// private void EnterStateLoad() { // Create the level m_coroutine = GlobalDirector.ExecuteCoroutine(StaggerLevelCreation(() => { // We're done loading m_fsm.ExecuteAction(k_actionNext); })); }
/// @param newScore /// The score to set /// @param callback /// The function to call when the score finished updated /// public void SetScore(int newScore, Action callback = null) { // Update the text m_loopedSFX = m_audioService.PlaySFXLooped(AudioIdentifiers.k_loopScoreCounting); m_tweenCount = m_scoreText.DOCount(m_score, newScore, 1.0f, () => { m_loopedSFX.SafeStop(); m_score = newScore; }); // Update the stars m_coroutine = GlobalDirector.ExecuteCoroutine(StaggerStarProgress(newScore, callback)); }