public void ServerMove(Vector3 position) { targeter.ClearTarget(); if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } agent.SetDestination(hit.position); }
public void CmdMove(Vector3 position) { if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } //checking if mouse pos is on navmesh targeter.ClearTarget(); //clearing traget of a unit if Move command is ordered agent.SetDestination(hit.position); }
public void Move(Vector3 position) { if (!NavMesh.SamplePosition(position, out NavMeshHit navHit, 1f, NavMesh.AllAreas)) { return; } _targeter.ClearTarget(); _navMeshAgent.SetDestination(navHit.position); }
public void ServerMove(Vector3 position) { targeter.ClearTarget(); //This is a Server Command. This method validates navmesh hit and then sets the players Agent destination to position if valid. if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } agent.SetDestination(hit.position); }
public void ServerMove(Vector3 position) { targeter.ClearTarget(); // return if the position is out of bounds of the nav mesh if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } // update position of unit (nav mesh agent) agent.SetDestination(hit.position); }
public void ServerMove(Vector3 position) { Debug.Log($"M@ [{GetType()}] SERVER MOVE"); // M@: targeter.ClearTarget(); // make sure this is a valid position if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } agent.SetDestination(hit.position); }
public void ServerMove(Vector3 position) { //Clear Target If It Has. targeter.ClearTarget(); //Validation For Move if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } //Move to hit Pos agent.SetDestination(hit.position); }
public void ServerMove(Vector3 position) { //clear targets when moving targeter.ClearTarget(); //check if clicked position for move is valid position on navmesh if (!NavMesh.SamplePosition(position, out NavMeshHit hit, 1f, NavMesh.AllAreas)) { return; } //set destination for navmesh agent agent.SetDestination(hit.position); }
public void ServerMove(Vector3 destination) { targeter.ClearTarget(); //is the point on a navMesh? NavMeshHit hit; if (!NavMesh.SamplePosition(destination, out hit, 1f, NavMesh.AllAreas)) { return; } //if so, move player on server (I think that b/c player has a NetworkTransform that is is synced with no need for a SyncVar) agent.SetDestination(hit.position); }