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); }
public void Mine(GameObject miningTarget) { //print("Mine: " + miningTarget); GetComponent <ActionScheduler>().StartAction(this); target = miningTarget.GetComponent <MiningTarget>(); }
public void Cancel() { StopSwingingPickaxe(); target = null; GetComponent <Mover>().Cancel(); }