void OnSceneGUI()
    {
        EnemyVision FOV = (EnemyVision)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(FOV.transform.position, Vector3.up, Vector3.forward, 360, FOV.view_Radius);
        Vector3 viewAngleA = FOV.DirFromAngle(-FOV.view_Angle / 2, false);
        Vector3 viewAngleB = FOV.DirFromAngle(FOV.view_Angle / 2, false);

        Handles.DrawLine(FOV.transform.position, FOV.transform.position + viewAngleA * FOV.view_Radius);
        Handles.DrawLine(FOV.transform.position, FOV.transform.position + viewAngleB * FOV.view_Radius);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in FOV.visibleTargets)
        {
            Handles.DrawLine(FOV.transform.position, visibleTarget.position);
        }
    }
示例#2
0
    private void OnSceneGUI()
    {
        EnemyVision ev = (EnemyVision)target;

        Handles.color = Color.blue;

        Handles.DrawWireArc(ev.transform.position, Vector3.up, Vector3.forward, 360, ev.viewRadius);
        Vector3 viewAngleA = ev.DirFromAngle(-ev.viewAngle / 2, false);
        Vector3 viewAngleB = ev.DirFromAngle(ev.viewAngle / 2, false);

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

        Handles.color = Color.red;

        foreach (Transform visibleTarget in ev.visibleTargets)
        {
            Handles.DrawLine(ev.transform.position, visibleTarget.position);
        }
    }