Esempio n. 1
0
 public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
 {
     if (state.IsFristPersion())
     {
         return(false);
     }
     if (state.GetMainMotor().NowMode == (short)ECameraPoseMode.Dead)
     {
         return(false);
     }
     if (state.PeekMode != ECameraPeekMode.Off)
     {
         return(false);
     }
     return(input.IsCameraFree || state.GetMainMotor().NowMode == (short)ECameraPoseMode.AirPlane ||
            state.GetMainMotor().NowMode == (short)ECameraPoseMode.Parachuting || input.IsDriveCar ||
            state.GetMainMotor().NowMode == (short)ECameraPoseMode.ParachutingOpen);
 }
Esempio n. 2
0
 public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
 {
     if (state.GetMainMotor().NowMode == (short)ECameraPoseMode.AirPlane)
     {
         return(false);
     }
     return(_isRight
         ? input.LeanState == LeanInConfig.PeekRight && state.LastPeekPercent >= 0
         : input.LeanState == LeanInConfig.PeekLeft && state.LastPeekPercent <= 0);
 }
Esempio n. 3
0
 private bool CanRotatePlayer(ICameraMotorState state)
 {
     if (state.IsFristPersion() && state.GetMainMotor().NowMode == (byte)ECameraPoseMode.Climb)
     {
         return(false);
     }
     if (state.IsFree())
     {
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
        public override void PreProcessInput(PlayerEntity player, ICameraMotorInput input, ICameraMotorState state)
        {
            var   config = input.GetPoseConfig(state.GetMainMotor().NowMode);
            float yaw    = state.FreeYaw + input.ArchorYaw;
            float pitch  = state.FreePitch + input.ArchorPitch;

            yaw   = CalculateFrameVal(yaw, input.DeltaYaw, config.YawLimit);
            pitch = CalculateFrameVal(pitch, input.DeltaPitch, config.PitchLimit);

            state.LastFreeYaw   = player.cameraStateNew.FreeYaw;
            state.LastFreePitch = player.cameraStateNew.FreePitch;
            state.FreeYaw       = YawPitchUtility.Normalize(yaw - input.ArchorYaw);
            state.FreePitch     = YawPitchUtility.Normalize(pitch - input.ArchorPitch);
        }
Esempio n. 5
0
        public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
        {
            if (input.IsDead)
            {
                return(false);
            }
            if (!input.CanWeaponGunSight)
            {
                return(false);
            }
            if (state.IsFree())
            {
                return(false);
            }
            var config = input.GetPoseConfig(state.GetMainMotor().NowMode);

            if (!config.CanSwitchView)
            {
                return(false);
            }

            if (state.ViewMode == ECameraViewMode.GunSight &&
                (input.FilteredCameraFocus || input.InterruptCameraFocus))
            {
                if (input.InterruptCameraFocus)
                {
                    if (Logger.IsDebugEnabled)
                    {
                        Logger.Debug("ForceInterruptGunSight");
                    }
                }
                return(false);
            }
            if (state.ViewMode == ECameraViewMode.ThirdPerson && !input.InterruptCameraFocus && (input.FilteredCameraFocus))
            {
                // DebugUtil.MyLog("Change cmr to gunsight");
                return(true);
            }

            if (state.ViewMode == ECameraViewMode.FirstPerson && !input.InterruptCameraFocus && (input.FilteredCameraFocus))
            {
                return(true);
            }

            return(state.ViewMode == ECameraViewMode.GunSight);
        }
Esempio n. 6
0
        public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
        {
            var config = input.GetPoseConfig(state.GetMainMotor().NowMode);

            if (!config.CanSwitchView)
            {
                return(false);
            }
            if (input.IsVariant)
            {
                return(false);
            }
            if (!SharedConfig.IsOffline && input.LockViewByRoom && input.ModelLoaded && !input.IsDead)
            {
                return(true);
            }

            if (state.IsFree())
            {
                return(false);
            }

            if (state.ViewMode == ECameraViewMode.FirstPerson && input.FilteredChangeCamera)
            {
                return(false);
            }

            if (state.ViewMode == ECameraViewMode.ThirdPerson && input.FilteredChangeCamera)
            {
                return(true);
            }

            if (state.ViewMode == ECameraViewMode.GunSight &&
                (input.FilteredCameraFocus || input.InterruptCameraFocus) &&
                state.LastViewMode == ECameraViewMode.FirstPerson)
            {
                return(true);
            }

            if (input.LastViewByOrder == (short)ECameraViewMode.FirstPerson)
            {
                return(true);
            }
            return(state.ViewMode == ECameraViewMode.FirstPerson);
        }