コード例 #1
0
ファイル: CameraPath.cs プロジェクト: unseen-code/tianqi_src
 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);
 }
コード例 #2
0
ファイル: CameraPath.cs プロジェクト: theomission/ozUnity
    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);
    }
コード例 #3
0
    private static void SceneGUIOrientationBased()
    {
        DisplayAtPoint();

        CameraPathOrientationList orientationList = _cameraPath.orientationList;
        Camera sceneCamera      = Camera.current;
        int    orientationCount = orientationList.realNumberOfPoints;

        for (int i = 0; i < orientationCount; i++)
        {
            CameraPathOrientation orientation = orientationList[i];
            if (_cameraPath.enableUndo)
            {
                Undo.RecordObject(orientation, "Modifying Orientation Point");
            }
            if (Vector3.Dot(sceneCamera.transform.forward, orientation.worldPosition - sceneCamera.transform.position) < 0)
            {
                continue;
            }

            string orientationLabel = orientation.displayName;
            orientationLabel += "\nat percentage: " + orientation.percent.ToString("F3");
            switch (orientation.positionModes)
            {
            case CameraPathPoint.PositionModes.FixedToPoint:
                orientationLabel += "\nat point: " + orientation.point.displayName;
                break;
            }

            Handles.Label(orientation.worldPosition, orientationLabel);
            float pointHandleSize = HandleUtility.GetHandleSize(orientation.worldPosition) * HANDLE_SCALE;
            Handles.color = (i == selectedPointIndex) ? _cameraPath.selectedPointColour : _cameraPath.unselectedPointColour;
            Handles.ArrowCap(0, orientation.worldPosition, orientation.rotation, pointHandleSize * 4);
            if (Handles.Button(orientation.worldPosition, Quaternion.identity, pointHandleSize, pointHandleSize, Handles.DotCap))
            {
                ChangeSelectedPointIndex(i);
                GUI.changed = true;
            }

            if (i == selectedPointIndex)
            {
                Quaternion currentRotation = orientation.rotation;
                currentRotation = Handles.DoRotationHandle(currentRotation, orientation.worldPosition);
                if (currentRotation != orientation.rotation)
                {
                    orientation.rotation = currentRotation;
                }
                CPPSlider(orientation);
            }
        }

        if (_cameraPath.showOrientationIndicators)//draw orientation indicators
        {
            Handles.color = _cameraPath.orientationIndicatorColours;
            float indicatorLength = _cameraPath.orientationIndicatorUnitLength / _cameraPath.pathLength;
            for (float i = 0; i < 1; i += indicatorLength)
            {
                Vector3    indicatorPosition   = _cameraPath.GetPathPosition(i);
                Quaternion inicatorRotation    = _cameraPath.GetPathRotation(i, false);
                float      indicatorHandleSize = HandleUtility.GetHandleSize(indicatorPosition) * HANDLE_SCALE * 4;
                Handles.ArrowCap(0, indicatorPosition, inicatorRotation, indicatorHandleSize);
            }
        }
    }