Ejemplo n.º 1
0
                    /* --------------- STATUS: INTRODUCTION, PLAYER HAS TO WAIT ---------------  */
    /*
     *  All the colours of the non-standard tiles will be shown
     *  When all colours have faded, then the game starts
     */
    IEnumerator Introduction(CameraFollow cameraFollow, SkipButton skipButton)
    {
        while(!cameraFollow.GetCameraReachedFinalPosition())                        // wait for the user to finish watching the introduction screen
        {
            yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
        }


        // if(settings.IsIntroductionScreen())                                         // check if the level has a introduction screen to show
        // {
            // tutorialManager.gameObject.SetActive(true);
          /*  ShowIntroductionScreen();                                               // if so, show it

            while(!hasWatchedIntroductionScreen)                                    // wait for the user to finish watching the introduction screen
            {
                
                yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
            }*/
        // }

        /* --------------- DISPLAYING NON-STANDARD TILES ---------------  */
                

        bool chooseCheckPoints = settings.GetNumberOfCheckpoints() > 0;             // are there any checkpoints to choose for this map
        ShowNonStandardTiles(chooseCheckPoints);        
        
        if(chooseCheckPoints)
        {
            while(!tileColorsIntroduction.IsReadyForCheckpoints())                  // once the colours have appeared, it will wait with the fading process
            {
                yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);               // check regularly if all the colours have appeared
            }

            ControlsCheckpoint checkpointController = GetComponent<ControlsCheckpoint>();   // get the controls for choosing the checkpoints
            bool isStoptimeForCheckpoints = settings.GetStoptimeForCheckpoints() > 0;       // get the boolean, if a limited time for choosing checkpoints is set
            SelectCheckpoints(checkpointController, isStoptimeForCheckpoints);
                                    
            while(!(isStoptimeForCheckpoints && timer.IsStopTimeOver()) &&          // there is a stopwatch for choosing checkpoints and it's not over yet and
                  !skipButton.IsButtonPressed())                                    // the skipButton, for confirming the player's selections, has not been pressed yet
            {                
                yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);               // it will check regularly if the player has choosen the checkpoints
            }
            
            FinishedSelectingCheckpoints(checkpointController);
            
            while(!cameraFollow.GetCameraReachedFinalPosition())                    // wait for the camera to be back in position
            {
                if(skipButton.IsButtonPressed())
                {
                    cameraFollow.GoToTargetInstantly();
                }
                yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
            }
            
            FinishShowingNonStandardTiles();
        }
                
        while(!tileColorsIntroduction.IsFinished())                                 // waiting for the tiles to finish fading
        {
            yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
        }

        WaitForCameraToBeInPlayingPosition();

        while(!cameraFollow.GetCameraReachedFinalPosition())                        // wait for the camera to be back in position
        {
            if(skipButton.IsButtonPressed())
            {
                cameraFollow.GoToTargetInstantly();
            }
            yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
        }
                
        SetCountdownForPlaying();

        while (!timer.IsStopTimeOver() && !skipButton.IsButtonPressed())            // as soon as the stoptime is over or the skipbutton pressed, the game will start
        {
            yield return new WaitForSeconds(TIME_TO_CHECK_AGAIN);
        }

        PrepareGameStart();        
        GameStarts();                                                               // start the game
    }