コード例 #1
0
 /**
  * Controller for weapon - enabling and disabling the weapon based on its position (within or out of restricted area).
  * @param colliding object - GameObject (weapon expected).
  * @param flag to enable/disable weapon - bool.
  */
 private void ShootingController(GameObject collidingObject, bool flag)
 {
     if (collidingObject.tag == "ShootControl")
     {
         Transform parent = collidingObject.transform.parent;
         if (parent.tag == "Weapon")
         {
             if (weapon == null || !parent.Equals(weapon))
             {
                 weapon        = parent.gameObject;
                 shooterScript = parent.GetComponent <Shooter>();
             }
             shooterScript.ControlShooting(flag);
         }
     }
 }