November 2018
Beginner
246 pages
5h 23m
English
This is a simple class that does three things:
The following lines show the code's that present in this class:
using UnityEngine; using System.Collections; public class Target : MonoBehaviour { private NavMeshAgent[] navAgents; public Transform targetMarker; void Start() { navAgents = FindObjectsOfType(typeof(NavMeshAgent)) as NavMeshAgent[]; } void UpdateTargets(Vector3 targetPosition) { foreach (NavMeshAgent agent in navAgents) { agent.destination = targetPosition; } } void Update() { int button = 0; //Get the point of the hit position when the mouse is //being clicked if(Input.GetMouseButtonDown(button)) ...Read now
Unlock full access