コード例 #1
0
 public GlidingPoseMotor(ECameraPoseMode modeId,
                         CameraConfigItem config,
                         HashSet <ECameraPoseMode> excludes,
                         IMotorActive active, int transitionTime = 200
                         ) : base(modeId, config, excludes, active, transitionTime)
 {
     _bezierUtil.CreateRandomPoints(1f, 1.5f, -2, 2, -0.3f, 0.3f, 4);
 }
コード例 #2
0
        public DeadPoseMotor(ECameraPoseMode modeId, CameraConfigItem config, HashSet <ECameraPoseMode> excludes, IMotorActive active, DeadCameraConfig deadConfig) : base(modeId, config, excludes, active)
        {
            _config = deadConfig;

            CameraActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.Pose, (int)modeId,
                                          (player, state) =>
            {
                player.orientation.Pitch = 0;
                Debug.Log("Enter dead pose");
            });
            _finalRotation = deadConfig.Roatation;
        }
コード例 #3
0
        private void HandleConfigItem(CameraConfigItem config)
        {
            config.PoseConfigs = config.PoseConfigs.OrderBy(var => var.CameraType).ToArray();

            foreach (var cameraConfigItem in config.PoseConfigs)
            {
                if (cameraConfigItem.Far < 100)
                {
                    cameraConfigItem.Far = 8000;
//                    switch (cameraConfigItem.CameraType)
//                    {
//                        case ECameraPoseMode.Stand:
//                        case ECameraPoseMode.DriveCar:
//                        case ECameraPoseMode.Prone:
//                        case ECameraPoseMode.Crouch:
//                        case ECameraPoseMode.Swim:
//                        case ECameraPoseMode.Rescue:
//                        case ECameraPoseMode.Dying:
//                        case ECameraPoseMode.Dead:
//                        case ECameraPoseMode.Climb:
//                        case ECameraPoseMode.AirPlane:
//                        case ECameraPoseMode.Parachuting:
//                        case ECameraPoseMode.ParachutingOpen:
//                        case ECameraPoseMode.Gliding:
//                            cameraConfigItem.Far = 8000;
//                            break;
//                        default:
//                            throw new ArgumentOutOfRangeException();
//                    }
                }
                if (Math.Abs(cameraConfigItem.Near) < 0.00001)
                {
                    cameraConfigItem.Near = 0.02f;
                }
            }

            if (config.ObserveConfig == null)
            {
                config.ObserveConfig                 = new ObserveCameraConfig();
                config.ObserveConfig.Offset          = new Vector3(0, 1, 0);
                config.ObserveConfig.ObserveDistance = 2;
            }

            if (config.ViewConfig == null)
            {
                config.ViewConfig = new ViewCameraConfig()
                {
                    DefaltFovTransitionTime     = 100,
                    OnHoldBreathTransitionTime  = 100,
                    OffHoldBreathTransitionTime = 100
                };
            }
        }
コード例 #4
0
        public DrivePoseMotor(ECameraPoseMode modeId,
                              CameraConfigItem config,
                              HashSet <ECameraPoseMode> excludes,
                              VehicleContext vehicleContext,
                              FreeMoveContext freeMoveContext

                              )
        {
            _modeId = (short)modeId;

            this.excludes = new HashSet <short>();
            foreach (var e in excludes)
            {
                this.excludes.Add((short)e);
            }

            _config = config;

            CameraActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.Pose, (int)modeId,
                                          (player, state) =>
            {
                if (player.IsOnVehicle())
                {
                    var vehicle = vehicleContext.GetEntityWithEntityKey(player.controlledVehicle.EntityKey);
                    player.controlledVehicle.CameraAnchorOffset    = vehicle.vehicleAssetInfo.CameraAnchorOffset;
                    player.controlledVehicle.CameraDistance        = vehicle.vehicleAssetInfo.CameraDistance;
                    player.controlledVehicle.CameraRotationDamping = vehicle.vehicleAssetInfo.CameraRotationDamping;
                }

                var cameraEulerAngle = player.cameraFinalOutputNew.EulerAngle;

                var carEulerAngle = player.cameraArchor.ArchorEulerAngle;

                var t           = cameraEulerAngle - carEulerAngle;
                state.FreeYaw   = t.y;
                state.FreePitch = t.x;
            });
            CameraActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.Pose, (int)modeId,
                                          (player, state) =>
            {
                var rotation             = player.cameraFinalOutputNew.EulerAngle;
                player.orientation.Yaw   = YawPitchUtility.Normalize(rotation.y);
                player.orientation.Pitch = YawPitchUtility.Normalize(rotation.x);

                state.LastFreePitch = 0;
                state.LastFreeYaw   = 0;
                state.FreeYaw       = 0f;
                state.FreePitch     = 0f;
            });
        }
コード例 #5
0
        public NormalPoseMotor(ECameraPoseMode modeId,
                               CameraConfigItem config,
                               HashSet <ECameraPoseMode> excludes,
                               IMotorActive active, int transitionTime = 200
                               )
        {
            _modeId = (short)modeId;

            this._excludes = new HashSet <short>();
            foreach (var e in excludes)
            {
                this._excludes.Add((short)e);
            }

            _transitionTime = transitionTime;
            _config         = config;
            _active         = active;
        }
コード例 #6
0
 public AirplanePoseMotor(ECameraPoseMode modeId, CameraConfigItem config, HashSet <ECameraPoseMode> excludes, VehicleContext vehicleContext, FreeMoveContext freeMoveContext) :
     base(modeId, config, excludes, vehicleContext, freeMoveContext)
 {
 }