Exemple #1
0
    private void CheckWallFit()
    {
        if (spawner.Wall.GetComponent <MoveTo>().IsConcluded&& !spawner.IsRespawning && !gameOver)
        {
            speed += speedIncreaseDelta;
            audioHandler.IncreaseBackgroundPitch(pitchIncreaseDelta);
            fits        += 1;
            fitSequence += 1;
            streak      += 1;
            bestStreak   = (streak > bestStreak) ? streak : bestStreak;
            if (fitSequence == maxFitSequence)
            {
                fitSequence = 0;
                IncreaseDifficulty();
                switch (currDifficulty)
                {
                case Difficulty.Level1:
                    achievementManager.UpdateLevel1Achievement();
                    break;

                case Difficulty.Level2:
                    achievementManager.UpdateLevel2Achievement();
                    break;

                case Difficulty.Level3:
                    achievementManager.UpdateLevel3Achievement();
                    break;

                case Difficulty.Level4:
                    achievementManager.UpdateLevel4Achievement();
                    break;

                case Difficulty.Level5:
                    achievementManager.UpdateMaxLevelAchievement();
                    break;
                }
                IncreaseLives();
                UIHandler.PlayLevelUpAnimation();
                StartCoroutine(audioHandler.PlayLevelUp(0.4f));
            }
            else
            {
                StartCoroutine(audioHandler.PlayWallFit(0.4f));
            }
            ScorePoints();
            fastForward = false;
            spawner.PlayWallFitAnimation();
            if (fits == 1 && !PlayerPrefManager.GetRotateTutorialDone())
            {
                spawner.DestroyGameObjects();
                spawner.SpawnTutorialRotateObjects();
                UIHandler.ShowRotateTutorial();
                PlayerPrefManager.SetRotateTutorialDone(1);
            }
            else if (fits == 2 && !PlayerPrefManager.GetFlipTutorialDone())
            {
                spawner.DestroyGameObjects();
                spawner.SpawnTutorialFlipObjects();
                UIHandler.ShowFlipTutorial();
                PlayerPrefManager.SetFlipTutorialDone(1);
            }
            else
            {
                StartCoroutine(spawner.DelayedRespawn(0.5f));
            }
        }
    }