コード例 #1
0
    // Use this for initialization
    void Start()
    {
        fovController   = GetComponentInChildren <CameraFieldOfView>();
        targetsInRadius = new Collider[0];
        swivel          = transform.GetChild(0);

        SetCameraState(S_STATE);
    }
コード例 #2
0
    void OnSceneGUI()
    {
        CameraFieldOfView fov = (CameraFieldOfView)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fov.transform.position, Vector3.up, Vector3.forward, 360, fov.viewRadius);
        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);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fov.visibleTargets)
        {
            Handles.DrawLine(fov.transform.position, visibleTarget.position);
        }
    }
コード例 #3
0
 public void SetFieldOfView(int columns)
 {
     GetComponent <Camera>().orthographicSize = CameraFieldOfView.GetFieldOfView(columns);
 }