コード例 #1
0
 void HandleCollision(Collision2D col)
 {
     if (dead)
     {
         return;
     }
     if (col.gameObject.tag == "Obstacle")
     {
         Die();
     }
     else if (col.gameObject.tag == "Ground" && !onGround)
     {
         if (transform.rotation.z <= -0.7f + Mathf.Epsilon || transform.rotation.z >= 0.7f - Mathf.Epsilon)
         {
             Die();
         }
         else if (Mathf.Abs(transform.localRotation.z) < 0.01f)
         {
             onGround = true;
             generate.AddToScore();
         }
     }
 }