示例#1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     //Enemy... killed when not dashing
     if (collision.gameObject.tag == "Enemy" && !shield.GetIsWearingShield() && !isDashing)
     {
         Die();
     }
     else if (collision.gameObject.tag == "DeadlyThing" && !shield.GetIsWearingShield())
     {
         Die();
     }
     else if (collision.gameObject.tag == "Invincible")
     {
         InvincibleObject invincibleObject = collision.gameObject.GetComponent <InvincibleObject>();
         if (invincibleObject != null)
         {
             shield.WearShieldInSec(invincibleObject.GetInvincibleTime());
         }
     }
 }
示例#2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Invincible")
     {
         InvincibleObject invincibleObject = collision.gameObject.GetComponent <InvincibleObject>();
         if (invincibleObject != null)
         {
             shield.WearShieldInSec(invincibleObject.GetInvincibleTime());
         }
     }
     else if (collision.gameObject.tag == "Enemy" && !shield.GetIsWearingShield() && !isDashing)
     {
         Die();
     }
     else if (collision.gameObject.tag == "DieBottomCollider")
     {
         Die();
     }
     else if (collision.gameObject.tag == "Water")
     {
         StartCoroutine(DrownPlayer());
     }
 }