Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Waypoint.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Waypoint : MonoBehaviour
{
    public Waypoint[] edges;
    public Vector3 Position { get { return transform.position; } }
    // Start is called before the first frame update
    void Start()
    {
        
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.green;

        if (edges != null && edges.Length > 0)
        {
            foreach (Waypoint wp in edges)
            {
                if (wp != null)
                {
                    Gizmos.DrawLine(transform.position, wp.transform.position);
                }
            }
        }

        Gizmos.DrawSphere(transform.position, 1.5f);
    }

    private void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.yellow;
        if (edges != null && edges.Length > 0)
        {
            foreach (Waypoint wp in edges)
            {
                if (wp != null)
                {
                    Gizmos.DrawWireSphere(wp.transform.position,2f);
                }
            }
        }
    }
}