Beispiel #1
0
    private void OnSceneGUI()
    {
        LineOfSight fov = (LineOfSight)target;

        Handles.color = Color.white;
        Vector3 viewAngleA = fov.DirFromAngle(-fov.viewAngle / 2, false);
        Vector3 viewAngleB = fov.DirFromAngle(fov.viewAngle / 2, false);

        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleA * fov.viewRadius);
        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleB * fov.viewRadius);
    }
    private void OnSceneGUI()
    {
        LineOfSight los = (LineOfSight)target;

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

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

        Handles.color = Color.red;
        foreach (Transform visibleTarget in los.visibleTargets)
        {
            Handles.DrawLine(los.transform.position, visibleTarget.position);
        }
    }
Beispiel #3
0
    void OnSceneGUI()
    {
        LineOfSight lineOfSight = (LineOfSight)target;

        Handles.color = Color.white;
        Transform transform = lineOfSight.transform;

        Handles.DrawWireArc(transform.position, transform.up, transform.forward, 360, lineOfSight.viewRadius);
        Handles.color = new Color(1, 0, 0, 0.5f);
        Vector3 viewAngleA = lineOfSight.transform.rotation * lineOfSight.DirFromAngle(-lineOfSight.viewAngle / 2);
        Vector3 viewAngleB = lineOfSight.transform.rotation * lineOfSight.DirFromAngle(lineOfSight.viewAngle / 2);

        Handles.DrawLine(transform.position, transform.position + viewAngleA * lineOfSight.viewRadius);
        Handles.DrawLine(transform.position, transform.position + viewAngleB * lineOfSight.viewRadius);
        // Handles.DrawWireArc();
        Handles.DrawSolidArc(transform.position, transform.up, viewAngleA, lineOfSight.viewAngle, lineOfSight.viewRadius);


        Handles.color = Color.cyan;
        foreach (Transform visibleTarget in lineOfSight.visibleTargets)
        {
            Handles.DrawLine(lineOfSight.transform.position, visibleTarget.position);
        }
    }