コード例 #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Plank" || other.tag == "Shark")
     {
         Bars.ChangeHealth(-5);
         rand = Random.Range(0, 2);
         if (rand == 1)
         {
             if (decals != null)
             {
                 decals.SetActive(true);
             }
         }
         else
         {
             if (decals2 != null)
             {
                 decals2.SetActive(true);
             }
         }
         if (other.tag == "Plank")
         {
             other.gameObject.SetActive(false);
         }
         else if (other.tag == "Shark")
         {
             other.gameObject.tag = "Untagged";
         }
     }
 }