Beispiel #1
0
 private void FinishedSelectingCheckpoints(ControlsCheckpoint checkpointController)
 {
     timer.Disappear();                                                      // let the timer disappear
     skipButton.Reset();                                                     // reset the skipButton
     GetComponentInChildren<CheckpointCounter>().Disappear();                // make the checkpointCounter disappear
     checkpointController.enabled = false;                                   // disable the checkpointController, since we don't need it anymore
     GetPlayerCamera().orthographic = false;                                 // change the projection of the camera
     cameraFollow.enabled = true;                                            // enable the player camera again
     cameraFollow.ChangeCameraSettings(false, true, CAMERA_TIME_ALIGNMENT);  // change settings for a nice effect, while going back to the last target
     cameraFollow.GetBackInPosition();                                       // go back to target
 }
Beispiel #2
0
    private void SelectCheckpoints(ControlsCheckpoint checkpointController, bool isStoptimeForCheckpoints)
    {
        checkpointTiles = tiles.GetCheckpointTiles();                           // prepare the place for adding the checkpoints
        skipButton.ResetForCheckpoints();                                       // The button will reset its booleans and change its text        
        cameraFollow.enabled = false;                                           // deactivate the camera script            
        GetPlayerCamera().orthographic = true;                                  // change the projection of the camera
        checkpointController.enabled = true;                                    // enable the checkpointController
        checkpointController.GetStarted(settings.GetNumberOfCheckpoints(),      // and get it started
            checkpointTiles, tiles, GetPlayerCamera(), GetComponentInChildren<CheckpointCounter>()/* , GetComponentInChildren<CheckpointCounter>() */);

        if(isStoptimeForCheckpoints)                                            
        {
            timer.Show();                                                       // show the timer
            timer.SetStopWatch(settings.GetStoptimeForCheckpoints());           // and give it the stopwatchtime
        }
    }
Beispiel #3
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
    }