예제 #1
0
    public IEnumerator LevelEndCo(Collider2D other)
    {
        theHighScore.SaveScore();                               // save the score the player had at the end of the level

        yield return(new WaitForSeconds(TIMEUNTILFREEZE));

        // AudioManager.instance.PlayMusic(levelCompleteMusic);
        //levelMusic.Stop ();
        //levelCompleteMusic.Play ();
        bossMusic.Stop();
        AudioManager.instance.ChangeMusic(levelCompleteMusic, 5);
        Time.timeScale = 0f;
        other.gameObject.GetComponent <GimmickController> ().canMove = false;
        float endPause = Time.realtimeSinceStartup + FREEZETIME;


        while (Time.realtimeSinceStartup < endPause)
        {
            yield return(0);
        }

        //yield return new WaitForSeconds (FREEZETIME); //CAN'T WAIT FOR TIME WHEN TIME'S FROZEN!
        theHighScore.LogScores();                   // log all of the scores for that level
        theHighScore.LogTopFiveScores();            // log the top five scores for that level

        //Debug.Log ("Got this far");
        //fade out of the game and load the Level complete screen which will load the next screen via the LevelTitleScreenScript
        ScreenTransition.FadeScreen(nextLevel, loadUsingColor, fadeSpeed);
        //Time.timeScale = 1f;

        //this will be done through the levelTitle Screen Script
        // SceneManager.LoadScene(nextLevel);
    }
예제 #2
0
 //loads the level select menu
 public void LevelSelect()
 {
     PlayerPrefs.SetInt(levelProgressKey, 0);
     PlayerPrefs.SetInt("Current Score: ", 0);//sets the current score back to 0
     ScreenTransition.FadeScreen(levelSelect, loadToColor, fadeSpeed);
     // SceneManager.LoadScene(levelSelect);// loads the levelSelect level
     Time.timeScale = 1f;
 }
예제 #3
0
    // restarts the player from the begining of the level
    public void Restart()
    {
        PlayerPrefs.SetInt("Current Score: ", 0);//sets the current score back to 0
        ScreenTransition.FadeScreen(SceneManager.GetActiveScene().name, loadToColor, fadeSpeed);

        // SceneManager.LoadScene(SceneManager.GetActiveScene().name);// gets the current scenes name
        Time.timeScale = 1f;
    }
예제 #4
0
 void Update()
 {
     if (timeToWait > 0)
     {
         timeToWait -= Time.deltaTime;
     }
     else
     {
         ScreenTransition.FadeScreen(nextScene, loadToColor, fadeSpeed);
     }
 }
예제 #5
0
 //each door has a collider that is a trigger
 void OnTriggerStay2D(Collider2D other)
 {
     //if gimmick hits the doors trigger
     if (other.tag == "Gimmick")
     {
         //and if gimmick jumps while triggering the doors trigger
         if (Input.GetButtonDown("Go into Door"))
         {
             //load to the coresponding level
             //SceneManager.LoadScene(levelToLoad);
             ScreenTransition.FadeScreen(levelToLoad, loadToColor, fadeSpeed);
         }
     }
 }
예제 #6
0
    // This loads the first level and locks all but the first level for the level select menu
    // In this instence we are unlocking all levels
    public void NewGame()
    {
        //SceneManager.LoadScene(firstLevel);// loads the first level
        ScreenTransition.FadeScreen(firstLevel, loadToColor, fadeSpeed);
        Time.timeScale = 1f;
        // For regular gaming set the int to 0 to lock all but the first level
        for (int i = 0; i < levelNames.Length; i++)
        {
            PlayerPrefs.SetInt(levelNames[i], 1);
        }

        // set max health to six and Bonus Hearts collected to false (zero) for each level
        PlayerPrefs.SetInt(maxHealthKey, 6);
        PlayerPrefs.SetInt(caveBHFoundKey, 0);
        PlayerPrefs.SetInt(factoryBHFoundKey, 0);
        PlayerPrefs.SetInt(seasideBHFoundKey, 0);
        PlayerPrefs.SetInt(forestBHFoundKey, 0);
        PlayerPrefs.SetInt(levelProgressKey, 0);
    }
예제 #7
0
 //This loads the Level Select menu
 public void Continue()
 {
     //SceneManager.LoadScene(levelSelect);
     ScreenTransition.FadeScreen(levelSelect, loadToColor, fadeSpeed);
     Time.timeScale = 1f;
 }