DonutDonkey_U_MultimediaApplication_Fps/Assets/Script/Mono/Actors/FOV/FieldOfViewEditor.cs
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Script.Mono.Actors.FOV
{
    
    [CustomEditor (typeof (FieldOfView))]
    public class FieldOfViewEditor : Editor {

        void OnSceneGUI() {
            FieldOfView fow = (FieldOfView)target;
            Handles.color = Color.white;
            Handles.DrawWireArc (fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius);
            Vector3 viewAngleA = fow.DirFromAngle (-fow.viewAngle / 2, false);
            Vector3 viewAngleB = fow.DirFromAngle (fow.viewAngle / 2, false);

            Handles.DrawLine (fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius);
            Handles.DrawLine (fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius);

            Handles.color = Color.red;
            foreach (Transform visibleTarget in fow.visibleTargets) {
                Handles.DrawLine (fow.transform.position, visibleTarget.position);
            }
        }
    }
}
#endif