//when an object collides with something, this is called
 private void OnCollisionEnter(Collision collision)
 {
     //checking the 'layer' that the object we collided with is on
     if (collision.collider.gameObject.layer == 10)
     {
         die.Die();
     }
 }
Esempio n. 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && !collision.gameObject.GetComponent <PlayerDie>().isDead)
     {
         PlayerDie player = collision.gameObject.GetComponent <PlayerDie>();
         player.Die();
     }
 }
Esempio n. 3
0
 void CheckWillPlayerBeKilled()
 {
     //    canKillPlayer = Physics2D.OverlapBox(bottomCheck.position, bottomCubeSize, 0, playerLayer);
     if (canKillPlayer && !player.isDead)
     {
         Debug.Log("Should KillPlayer");
         player.Die();
     }
 }
Esempio n. 4
0
    private IEnumerator DrowningAnimation()
    {
        while (transform.position.y > -2)
        {
            transform.position += Vector3.down * Time.deltaTime * 4;
            yield return(null);
        }

        player.Die();
    }
Esempio n. 5
0
    private IEnumerator CrashingAnimation()
    {
        while (!squeezeAnimation.HasAnimationCompleted)
        {
            squeezeAnimation.Animate(minScale, animationSpeed);
            yield return(null);
        }

        yield return(new WaitForSeconds(.25f));

        player.Die();
    }
Esempio n. 6
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && !collision.gameObject.GetComponent <PlayerDie>().isDead)
     {
         if (timeTillExplosion <= 0)
         {
             //   Debug.Log("OnTriggerSTAycircle");
             PlayerDie player = collision.gameObject.GetComponent <PlayerDie>();
             player.Die();
         }
     }
 }