public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
        {
            if (state.IsFree())
            {
                return(false);
            }
            if (!state.GetMainConfig().CanSwitchView)
            {
                return(false);
            }
            //if (state.ViewMode.Equals(ECameraViewMode.FirstPerson) && (input.ChangeCamera))
            if (state.ViewMode == ECameraViewMode.FirstPerson && input.FilteredChangeCamera)
            {
                return(false);
            }
            //if (state.ViewMode.Equals(ECameraViewMode.ThirdPerson) &&  input.ChangeCamera)
            if (state.ViewMode == ECameraViewMode.ThirdPerson && input.FilteredChangeCamera)
            {
                return(true);
            }

            //if (state.ViewMode.Equals(ECameraViewMode.GunSight) && input.IsCameraFocus && state.LastViewMode.Equals(ECameraViewMode.FirstPerson))
            if (state.ViewMode.Equals(ECameraViewMode.GunSight) && (input.FilteredCameraFocus || input.ForceChangeGunSight || input.ForceInterruptGunSight) && state.LastViewMode.Equals(ECameraViewMode.FirstPerson))
            {
                return(true);
            }

            return(state.ViewMode == ECameraViewMode.FirstPerson);
        }
Beispiel #2
0
        public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
        {
            if (state.IsFree())
            {
                return(false);
            }
            if (!state.GetMainConfig().CanSwitchView)
            {
                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);
        }
Beispiel #3
0
        public override void PreProcessInput(PlayerEntity player, ICameraMotorInput input, ICameraMotorState state)
        {
            var   config = state.GetMainConfig();
            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);
        }
Beispiel #4
0
        public override bool IsActive(ICameraMotorInput input, ICameraMotorState state)
        {
            if (input.IsDead)
            {
                return(false);
            }
            if (!input.CanWeaponGunSight)
            {
                return(false);
            }
            if (state.IsFree())
            {
                return(false);
            }
            if (!state.GetMainConfig().CanSwitchView)
            {
                return(false);
            }

            if (state.ViewMode == ECameraViewMode.GunSight &&
                (input.FilteredCameraFocus || input.ForceChangeGunSight || input.ForceInterruptGunSight))
            {
                if (input.ForceInterruptGunSight)
                {
                    if (Logger.IsDebugEnabled)
                    {
                        Logger.Debug("ForceInterruptGunSight");
                    }
                }
                return(false);
            }

            //if (state.ViewMode.Equals(ECameraViewMode.ThirdPerson) &&  input.IsCameraFocus)
            if (state.ViewMode == ECameraViewMode.ThirdPerson && !input.ForceInterruptGunSight && (input.FilteredCameraFocus || input.ForceChangeGunSight))
            {
                return(true);
            }

            //if (state.ViewMode.Equals(ECameraViewMode.FirstPerson) && input.IsCameraFocus)
            if (state.ViewMode == ECameraViewMode.FirstPerson && !input.ForceInterruptGunSight && (input.FilteredCameraFocus || input.ForceChangeGunSight))
            {
                return(true);
            }

            return(state.ViewMode == ECameraViewMode.GunSight);
        }
Beispiel #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);
            }
            if (!state.GetMainConfig().CanSwitchView)
            {
                return(false);
            }

            if (state.ViewMode == ECameraViewMode.GunSight &&
                (input.FilteredCameraFocus || input.InterruptCameraFocus))
            {
                //   DebugUtil.MyLog(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);
        }