コード例 #1
0
 /*
  * OnCollisionEnter2D - manages many player collision
  */
 void OnCollisionEnter2D(Collision2D col)
 {
     if ((col.gameObject.GetComponent <Enemy>() != null ||
          col.gameObject.GetComponent <EnemyFlying>() != null ||
          col.gameObject.name == "DeathZone"
          ) &&
         deathHandler.IsAlive)    // Can only die once, or states will break
     {
         deathHandler.OnDeath();
         AnimateDeath();
     }
 }