public void Update() { while (!combatController.selected) { return; } distanceCompare.DistanceTest(distanceCalc); if (Input.GetMouseButtonDown(0) && distanceCompare.InRange == true && canPlaceWaypoint && !hoveringOverSomething && !EventSystem.current.IsPointerOverGameObject()) // Left Click { Clicked(GetThePoint.PickVector3()); //send point out to all relevant scripts return; } if (Input.GetMouseButtonDown(1) && !hoveringOverSomething && !EventSystem.current.IsPointerOverGameObject()) // Right Click { RemoveWaypoint(GetThePoint.PickVector3()); if (canPlaceWaypoint) { distanceCalc.currentDistance = 0; canPlaceWaypoint = false; return; } if (!canPlaceWaypoint) { distanceCalc.currentDistance = 0; canPlaceWaypoint = true; return; } return; } }
public override void RemoveCommand() { RemoveWaypoint(GetThePoint.PickVector3()); distanceCalc.currentDistance = 0; canPlaceWaypoint = false; return; }
void Update() { Vector3 targetPoint = GetThePoint.PickVector3(); if (targetPoint != Vector3.zero) { navMeshAgent.SetDestination(targetPoint); //create the path pointing to target } pathway = navMeshAgent.path.corners; line.positionCount = pathway.Length; for (int i = 0; i < pathway.Length; i++) { line.SetPosition(i, new Vector3(pathway[i].x, ((pathway[i].y) + (lineOffset)), pathway[i].z)); } }