コード例 #1
0
        public override IEnumerator Execute(GameObject target, IAction[] actions, int index)
        {
            CameraMotor motor = (this.mainCameraMotor ? CameraMotor.MAIN_MOTOR : this.cameraMotor);

            if (motor != null && motor.cameraMotorType.GetType() == typeof(CameraMotorTypeAdventure))
            {
                float initTime = Time.time;
                CameraMotorTypeAdventure adventureMotor = (CameraMotorTypeAdventure)motor.cameraMotorType;

                Vector3 aTargetOffset = adventureMotor.targetOffset;
                Vector3 bTargetOffset = this.changeTargetOffset ? this.targetOffset : aTargetOffset;

                Vector3 aPivotOffset = adventureMotor.pivotOffset;
                Vector3 bPivotOffset = this.changePivotOffset ? this.pivotOffset : aPivotOffset;

                while (initTime + this.duration >= Time.time)
                {
                    float t = Mathf.Clamp01((Time.time - initTime) / this.duration);
                    adventureMotor.targetOffset = Vector3.Lerp(aTargetOffset, bTargetOffset, t);
                    adventureMotor.pivotOffset  = Vector3.Lerp(aPivotOffset, bPivotOffset, t);

                    yield return(null);
                }

                adventureMotor.targetOffset = bTargetOffset;
                adventureMotor.pivotOffset  = bPivotOffset;
            }

            yield return(0);
        }
コード例 #2
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            CameraMotor motor = this.mainCamera ? CameraMotor.MAIN_MOTOR : this.cameraMotor;

            if (motor == null)
            {
                return(true);
            }

            CameraMotorTypeAdventure   motorTPS = motor.cameraMotorType as CameraMotorTypeAdventure;
            CameraMotorTypeFirstPerson motorFPS = motor.cameraMotorType as CameraMotorTypeFirstPerson;

            float x = this.pitch.GetValue(target);
            float y = this.yaw.GetValue(target);

            if (motorTPS != null)
            {
                motorTPS.AddRotation(y, x);
            }
            if (motorFPS != null)
            {
                motorFPS.AddRotation(y, x);
            }

            return(true);
        }
コード例 #3
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            CameraMotor motor = (this.mainCameraMotor ? CameraMotor.MAIN_MOTOR : this.cameraMotor);

            if (motor != null && motor.cameraMotorType.GetType() == typeof(CameraMotorTypeAdventure))
            {
                CameraMotorTypeAdventure adventureMotor = (CameraMotorTypeAdventure)motor.cameraMotorType;
                adventureMotor.allowOrbitInput = this.allowOrbitInput;
                adventureMotor.allowZoom       = this.allowZoom;
                adventureMotor.avoidWallClip   = this.avoidWallClip;
            }

            return(!this.changeTargetOffset && !this.changePivotOffset);
        }