Пример #1
0
    IEnumerator unlockNextLevel()
    {
        float smooth = camera.getSpeed();

        camera.setSpeed(0.1f);

        bool credits = false;

        yield return(new WaitForSeconds(1f));

        camera.setTarget(originalPositions[maxUnlockedIndex].transform, false);

        yield return(new WaitForSeconds(1f));

        originalPositions[maxUnlockedIndex].setState(levelState.done);
        for (int j = 0; j < restPositions0.Length; j++)
        {
            restPositions[maxUnlockedIndex][j].setState(levelState.done);
        }
        originalPositions[maxUnlockedIndex].activeParticles(particles.green);

        if (maxUnlockedIndex < originalPositions.Length - 1)
        {
            yield return(new WaitForSeconds(1f));

            camera.setTarget(originalPositions[maxUnlockedIndex + 1].transform, false);

            yield return(new WaitForSeconds(1f));

            originalPositions[maxUnlockedIndex + 1].setState(levelState.available);
            for (int j = 0; j < restPositions0.Length; j++)
            {
                restPositions[maxUnlockedIndex + 1][j].setState(levelState.available);
            }
            originalPositions[maxUnlockedIndex + 1].activeParticles(particles.red);
        }
        else
        {
            credits = true;
        }

        yield return(new WaitForSeconds(1f));

        camera.setTarget(menuPlayerMovement.transform, false);

        yield return(new WaitForSeconds(0.85f));

        if (credits)
        {
            yield return(new WaitForSeconds(0.5f));

            exitToCredits();
        }
        else
        {
            Globals.lastLevelDone = false;
            menuPlayerMovement.setActive(true);
            camera.setLooking();
            camera.setSpeed(smooth);
        }
    }