Beispiel #1
0
 private bool InteractWithMining()
 {
     RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
     foreach (RaycastHit hit in hits)
     {
         MiningTarget miningTarget = hit.transform.GetComponent <MiningTarget>();
         if (miningTarget == null)
         {
             continue;
         }
         if (Input.GetMouseButtonDown(0))
         {
             GetComponent <Miner>().Mine(miningTarget.gameObject);
         }
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public void Mine(GameObject miningTarget)
 {
     //print("Mine: " + miningTarget);
     GetComponent <ActionScheduler>().StartAction(this);
     target = miningTarget.GetComponent <MiningTarget>();
 }
Beispiel #3
0
 public void Cancel()
 {
     StopSwingingPickaxe();
     target = null;
     GetComponent <Mover>().Cancel();
 }