Exemplo n.º 1
0
 private void InitialiseLists()
 {
     if (this._orientationList == null)
     {
         this._orientationList = base.get_gameObject().AddComponent <CameraPathOrientationList>();
     }
     if (this._fovList == null)
     {
         this._fovList = base.get_gameObject().AddComponent <CameraPathFOVList>();
     }
     if (this._tiltList == null)
     {
         this._tiltList = base.get_gameObject().AddComponent <CameraPathTiltList>();
     }
     if (this._speedList == null)
     {
         this._speedList = base.get_gameObject().AddComponent <CameraPathSpeedList>();
     }
     if (this._eventList == null)
     {
         this._eventList = base.get_gameObject().AddComponent <CameraPathEventList>();
     }
     if (this._delayList == null)
     {
         this._delayList = base.get_gameObject().AddComponent <CameraPathDelayList>();
     }
     this._orientationList.Init(this);
     this._fovList.Init(this);
     this._tiltList.Init(this);
     this._speedList.Init(this);
     this._eventList.Init(this);
     this._delayList.Init(this);
 }
    private static void SceneGUITiltBased()
    {
        DisplayAtPoint();

        CameraPathTiltList pointList   = _cameraPath.tiltList;
        Camera             sceneCamera = Camera.current;
        int pointCount = pointList.realNumberOfPoints;

        for (int i = 0; i < pointCount; i++)
        {
            CameraPathTilt point = pointList[i];
            if (_cameraPath.enableUndo)
            {
                Undo.RecordObject(point, "Modifying Tilt Point");
            }
            if (Vector3.Dot(sceneCamera.transform.forward, point.worldPosition - sceneCamera.transform.position) < 0)
            {
                continue;
            }

            string pointLabel = point.displayName;
            pointLabel += "\nvalue: " + point.tilt.ToString("F1") + "\u00B0";

            Handles.Label(point.worldPosition, pointLabel);
            float pointHandleSize = HandleUtility.GetHandleSize(point.worldPosition) * HANDLE_SCALE;
            bool  pointIsSelected = i == selectedPointIndex;
            Handles.color = (pointIsSelected) ? _cameraPath.selectedPointColour : _cameraPath.unselectedPointColour;

            float      tiltSize = 2.0f;
            Vector3    pointForwardDirection = _cameraPath.GetPathDirection(point.percent, false);
            Quaternion qTilt        = Quaternion.AngleAxis(-point.tilt, pointForwardDirection);
            Quaternion pointForward = Quaternion.LookRotation(pointForwardDirection);
            Handles.CircleCap(0, point.worldPosition, pointForward, tiltSize);
            Vector3 horizontalLineDirection = ((qTilt * Quaternion.AngleAxis(-90, Vector3.up)) * pointForwardDirection).normalized * tiltSize;
            Vector3 horizontalLineStart     = point.worldPosition + horizontalLineDirection;
            Vector3 horizontalLineEnd       = point.worldPosition - horizontalLineDirection;
            Handles.DrawLine(horizontalLineStart, horizontalLineEnd);

            Vector3 verticalLineDirection = (Quaternion.AngleAxis(-90, pointForwardDirection) * horizontalLineDirection).normalized * tiltSize;
            Vector3 verticalLineStart     = point.worldPosition + verticalLineDirection;
            Vector3 verticalLineEnd       = point.worldPosition;
            Handles.DrawLine(verticalLineStart, verticalLineEnd);

            if (Handles.Button(point.worldPosition, Quaternion.identity, pointHandleSize, pointHandleSize, Handles.DotCap))
            {
                ChangeSelectedPointIndex(i);
                GUI.changed = true;
            }

            if (i == selectedPointIndex)
            {
                CPPSlider(point);
            }
        }
    }
Exemplo n.º 3
0
    private void InitialiseLists()
    {
        if(_orientationList == null)
            _orientationList = gameObject.AddComponent<CameraPathOrientationList>();// ScriptableObject.CreateInstance<CameraPathOrientationList>();
        if (_fovList == null)
            _fovList = gameObject.AddComponent<CameraPathFOVList>();//ScriptableObject.CreateInstance<CameraPathFOVList>();
        if (_tiltList == null)
            _tiltList = gameObject.AddComponent<CameraPathTiltList>();//ScriptableObject.CreateInstance<CameraPathTiltList>();
        if (_speedList == null)
            _speedList = gameObject.AddComponent<CameraPathSpeedList>();//ScriptableObject.CreateInstance<CameraPathSpeedList>();
        if (_eventList == null)
            _eventList = gameObject.AddComponent<CameraPathEventList>();//ScriptableObject.CreateInstance<CameraPathEventList>();
        if (_delayList == null)
            _delayList = gameObject.AddComponent<CameraPathDelayList>();//ScriptableObject.CreateInstance<CameraPathDelayList>();

        _orientationList.Init(this);
        _fovList.Init(this);
        _tiltList.Init(this);
        _speedList.Init(this);
        _eventList.Init(this);
        _delayList.Init(this);
    }