示例#1
0
 /// <summary>
 /// OnCollisionEnter is called when this collider/rigidbody has begun
 /// touching another rigidbody/collider.
 /// </summary>
 /// <param name="other">The Collision data associated with this collision.</param>
 void OnCollisionEnter(Collision other)
 {
     Debug.Log("hit by: " + other.gameObject.name);
     TakeDamage(10f);
     if (healthBar.IsDead())
     {
         Destroy(gameObject);
     }
 }