Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class emove: MonoBehaviour {
- NavMeshAgent ePath;
- public GameObject[] POINT;
- void Start () {
- ePath = GetComponent<NavMeshAgent>();
- }
- void Update () {
- foreach (GameObject waypoint in POINT) {
- ePath.SetDestination(waypoint.transform.position);
- ePath.speed = 2;
- // I write this, if you have different idea tell me please
- if (waypoint.activeSelf == false) // waypoint had it own script, when enemy touch any point it set off
- {
- ePath.SetDestination(waypoint.transform.position); // move to any other active waypoint.
- ePath.speed = 2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement