Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class emove: MonoBehaviour {
  5.  
  6. NavMeshAgent ePath;
  7. public GameObject[] POINT;
  8.  
  9. void Start () {
  10. ePath = GetComponent<NavMeshAgent>();
  11. }
  12.  
  13. void Update () {
  14.  
  15. foreach (GameObject waypoint in POINT) {
  16. ePath.SetDestination(waypoint.transform.position);
  17. ePath.speed = 2;
  18.  
  19. // I write this, if you have different idea tell me please
  20. if (waypoint.activeSelf == false) // waypoint had it own script, when enemy touch any point it set off
  21. {
  22. ePath.SetDestination(waypoint.transform.position); // move to any other active waypoint.
  23. ePath.speed = 2;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement