Beispiel #1
0
    void Update()
    {
        //if off the screen kill the player
        if (transform.position.y <= offTheScreen)
        {
            pStats.takeDamage(200f);
        }


        //if the player dies restart the level
        if (pStats.hp() <= 0)
        {
            Application.LoadLevel(levelName);
        }


        healthBarSlider.value = pStats.hp();                                    // set the health bar to the current hp
        score.guiText.text    = "Score:" + pStats.point();                      // show the players score
    }