Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Waypoint.cs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Waypoint : MonoBehaviour
  5. {
  6. public Waypoint[] edges;
  7. public Vector3 Position { get { return transform.position; } }
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. }
  12. private void OnDrawGizmos()
  13. {
  14. Gizmos.color = Color.green;
  15. if (edges != null && edges.Length > 0)
  16. {
  17. foreach (Waypoint wp in edges)
  18. {
  19. if (wp != null)
  20. {
  21. Gizmos.DrawLine(transform.position, wp.transform.position);
  22. }
  23. }
  24. }
  25. Gizmos.DrawSphere(transform.position, 1.5f);
  26. }
  27. private void OnDrawGizmosSelected()
  28. {
  29. Gizmos.color = Color.yellow;
  30. if (edges != null && edges.Length > 0)
  31. {
  32. foreach (Waypoint wp in edges)
  33. {
  34. if (wp != null)
  35. {
  36. Gizmos.DrawWireSphere(wp.transform.position,2f);
  37. }
  38. }
  39. }
  40. }
  41. }