//Activates when something enter the trigger attached the the enemy gameObject
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //check if what hit this trigger was indeed the player
     if (collision.gameObject.tag.Equals("Player"))
     {
         manager.PlayerDied();
     }
 }
Beispiel #2
0
    void Update() // Update is called once per frame
    {
        //move(me);
        checkGround(groundCheck, 0.4f, groundMask); //are we in air?

        if (playerHealth <= 0)
        {
            deathCall.PlayerDied();
            Destroy(gameObject);
        }
    }