示例#1
0
    //void LevelUp (){
    //if (difficultyLvl == maxDifficultyLvl)
    //return;

    //scoreToNextLvl *= 2;
    //difficultyLvl++;

    //GetComponent<PlayerMove>().SetSpeed (difficultyLvl);
    //GetComponent<EnemyPath>().SetEnemySpeed (difficultyLvl);
    //}

    public void OnDeath()
    {
        isDead = true;

        //  Checks if player has score is higher and if items collected is higher
        if (PlayerPrefs.GetFloat("Highscore") < score && PlayerPrefs.GetFloat("MaxItems") < collects)
        {
            PlayerPrefs.SetFloat("Highscore", score);
            PlayerPrefs.SetInt("MaxItems", collects);
        }

        deathMenu.ToggleMenu(score, collects);
    }
示例#2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         livesSystem.TakeLife();
         // if the player triggers the hit box of the spike it'll take away a life from the player
         levelManager.RespawnPlayer();
         // after they die it'll respawn player into the last checkpoint touched
         if (livesSystem.currentLives() == 0)
         {
             Debug.Log('0');
             deathMenu.ToggleMenu();
             control.Done();
             // If lives go to zero the death menu will pop up
         }
     }
 }