//that will called every frame void Update() { if (GameRuleManager.GetTeam() == team && selected) { // if we click anywhere on screen with right mouse button if (Input.GetMouseButtonDown(1)) { // send ray RaycastHit hit; Ray clickRay = cam.ScreenPointToRay(Input.mousePosition); // if raycast hit to an object if (Physics.Raycast(clickRay, out hit)) { // set hit.point as target aIController.destination = hit.point; } } } // Check if we've reached the destination (or near of the destination) if (aIController.remainingDistance < 3.0f) { GoPosition(); } }
void Update() { //TODO: Make player can select and use only mans from his\her own team. if (_GameRuleManager.GetTeam() == team && selected) { if (Input.GetMouseButtonDown(1)) { // send ray RaycastHit hit; Ray clickRay = cam.ScreenPointToRay(Input.mousePosition); // if raycast hit to an object if (Physics.Raycast(clickRay, out hit)) { // set hit.point as target aIController.destination = hit.point; } } } }