コード例 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.GetComponent <ObstacleMover>() != null)
     {
         if (other.gameObject.GetComponent <ObstacleMover>().banano)
         {
             ump.CollectBanano();
             Destroy(other.gameObject);
         }
         else if (other.gameObject.tag == "CheckPoint")
         {
             ump.CheckPoint();
         }
         else if (other.gameObject.tag == "RCP")
         {
             ump.RcheckPoint();
         }
     }
 }
コード例 #2
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.GetComponent <ObstacleMover>() != null)
        {
            colliding = true;

            if (col.gameObject.GetComponent <ObstacleMover>().banano)
            {
                ump.CollectBanano();
                Destroy(col.gameObject);
            }
            else if (col.gameObject.GetComponent <ObstacleMover>().deadly)
            {
                ump.EndGame();
            }
            else if (col.gameObject.name == "GameOverTrigger")
            {
                ump.EndGame();
            }
        }
    }