Exemple #1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Invisiwall")
        {
            //If the GameObject has the same tag as specified, output this message in the console
            Debug.Log("You hit an invisible wall");
        }

        else if (collision.gameObject.tag == "Instakill")
        {
            Health = Health - Health;
            if (Health < 1)
            {
                isDead = true;
                Debug.Log("Dead");
                GameOverScreen.EndGame("Exploded");
            }
        }

        else
        {
            Health--;
            if (Health < 1)
            {
                isDead = true;
                Debug.Log("Dead");
                GameOverScreen.EndGame("Exploded");
            }
        }
    }
Exemple #2
0
 public void ReceiveHit(int hit)
 {
     hp -= hit;
     NotificationManager.instance.ShowNotification("Player hit " + hit, Color.red);
     if (hp < 0)
     {
         GameOverScreen.EndGame(true);
     }
 }
Exemple #3
0
 public void ReceiveHit(int hit)
 {
     NotificationManager.instance.ShowNotification("Enemy hit " + hit, Color.white);
     hp -= hit;
     if (hp < 0)
     {
         GameOverScreen.EndGame(false);
     }
 }
    void RespawnPlayer()
    {
        //disable character controlls.
        player.GetComponent <PlayerMovement>().enabled = false;
        player.GetComponent <TractorBeam>().enabled    = false;

        //disable portal open text if its open
        portalOpenedText.SetActive(false);

        //open up a respawn screen.
        GameOverScreen.EndGame("TimeOver");
    }
Exemple #5
0
 public void EndGame(bool win)
 {
     gameOverScreen.EndGame(win);
 }