コード例 #1
0
 private static void ScanForCannon()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0) /*&& Events.GetComponent<Pause>().paused == false*/)
     {
         Ray        ray;
         RaycastHit hit;
         ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit))
         {
             Cannon c = hit.transform.gameObject.GetComponent <Cannon>();
             if (c != null)
             {
                 if (c.player == PlayerMaster.CurrentTurn && !c.Moved && c.shots != 0)
                 {
                     currentCannon = hit.transform.GetComponentInChildren <CannonControll>();
                     CurrentPowerShow();
                     currentCannon.Selected = true;
                     currentCannon.StartCoroutine(CannonMaster.MoveToCannon());
                 }
             }
         }
     }
 }
コード例 #2
0
 public static void SetAICannon(Cannon can)
 {
     currentCannon          = can.GetComponentInChildren <CannonControll>();
     currentCannon.Selected = true;
     currentCannon.StartCoroutine(CannonMaster.MoveToCannon());
 }