예제 #1
0
    void LevelUp()
    {
        DifficultType difficult = DifficultType.NONE;

        CurrentLevel++;

        if (difficultyStepsQueue.Count == 0)
        {
            if (score % 15 == 0)
            {
                difficult = !rotator.canUseCrazySpeed ? DifficultType.SWITCH_CRAZY_SPEED : DifficultType.SWITCH_CRAZY_SPEED_CANCEL;
            }
            else if (score % 10 == 0)
            {
                difficult = DifficultType.SPEEDUP;
            }
            else if (score % 5 == 0)
            {
                difficult = !rotator.canInverseDir ? DifficultType.SWITCH_REVERSE : DifficultType.SWITCH_REVERSE_CANCEL;
            }
        }
        else
        {
            pointsRequiredToLevelUpQueue.Dequeue();
            difficult = difficultyStepsQueue.Dequeue();
        }

        switch (difficult)
        {
        case DifficultType.MORE_COLORS:
            spawner.AddColorsInGame(1);
            AudioMaster.instance.Play(SoundDefinitions.SFX_SPEED);
            break;

        case DifficultType.SPEEDUP:
            rotator.RotationSpeed += 25;
            AudioMaster.instance.Play(SoundDefinitions.SCRATCH_7);
            break;

        case DifficultType.SWITCH_REVERSE:
            rotator.StartInverseDirection();
            //canInverseDir = true;
            AudioMaster.instance.Play(SoundDefinitions.SFX_REVERSE);
            break;

        case DifficultType.SWITCH_REVERSE_CANCEL:
            rotator.StopInverseDirection();
            //canInverseDir = false;
            AudioMaster.instance.Play(SoundDefinitions.SFX_REVERSE);
            break;

        case DifficultType.SWITCH_CRAZY_SPEED:
            rotator.StartCrazySpeed();
            AudioMaster.instance.Play(SoundDefinitions.SCRATCH_10);
            break;

        case DifficultType.SWITCH_CRAZY_SPEED_CANCEL:
            rotator.StopCrazySpeed();
            AudioMaster.instance.Play(SoundDefinitions.SCRATCH_10);
            break;
        }
        levelUp.Show(difficult);

        //Debug.LogFormat ("<color=green>Level {0} a los {1} puntos -> Dificultad añadida: {2}</color>", currentLevel, score, difficult.ToString ());
    }