public void MoveSelectedRat() { HoleContentsCheck holeContentsCheck = selectedHole.GetComponent <HoleContentsCheck>(); RatMovement rat = holeContentsCheck.rat; rat.navAgent.SetDestination(rat.innerHolePositions[rat.end]); }
public GameObject PlayerChoice() { if (Input.GetMouseButtonDown(0)) { Ray ray = camera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { selectedHole = hit.collider.gameObject; if (selectedHole.GetComponent <HoleContentsCheck>()) { // check if the selected hole has a rat with the desired marble HoleContentsCheck holeContentsCheck = selectedHole.GetComponent <HoleContentsCheck>(); marble = holeContentsCheck.marble; RatMovement rat = holeContentsCheck.rat; return(selectedHole); } } } return(null); }