public void Generate(PlayerEntity player, IUserCmd usercmd, ICameraMotorState state, bool lockView)
        {
            var speedRatio = CameraUtility.GetGunSightSpeed(player, state);

            DeltaYaw   = usercmd.DeltaYaw * speedRatio;
            DeltaPitch = usercmd.DeltaPitch * speedRatio;
            if (usercmd.FilteredInput != null)
            {
                IsCameraFree         = usercmd.FilteredInput.IsInput(EPlayerInput.IsCameraFree);
                FilteredChangeCamera = lockView ? false : usercmd.FilteredInput.IsInput(EPlayerInput.ChangeCamera);
                FilteredCameraFocus  = usercmd.FilteredInput.IsInput(EPlayerInput.IsCameraFocus);
            }
            FrameInterval        = usercmd.FrameInterval;
            ChangeCamera         = lockView ? false :usercmd.ChangeCamera;
            IsCameraFocus        = usercmd.IsCameraFocus;
            IsCmdRun             = usercmd.IsRun;
            IsCmdMoveVertical    = usercmd.MoveVertical > 0;
            InterruptCameraFocus = usercmd.IsUseAction || usercmd.IsTabDown;

            if (player.hasStateInterface)
            {
                CurrentPostureState = player.stateInterface.State.GetCurrentPostureState();
                NextPostureState    = player.stateInterface.State.GetNextPostureState();
                LeanState           = player.stateInterface.State.GetNextLeanState();
                ActionState         = player.stateInterface.State.GetActionState();
                ActionKeepState     = player.stateInterface.State.GetActionKeepState();
            }
            else if (player.hasThirdPersonAppearance)
            {
                CurrentPostureState = (PostureInConfig)player.thirdPersonAppearance.PostureValue;
                NextPostureState    = (PostureInConfig)player.thirdPersonAppearance.NextPostureValue;
                ActionState         = (ActionInConfig)player.thirdPersonAppearance.ActionValue;
            }

            IsAirPlane          = player.gamePlay.GameState == GameState.AirPlane;
            IsDriveCar          = player.IsOnVehicle();
            IsDead              = player.gamePlay.IsLifeState(EPlayerLifeState.Dead);
            CanWeaponGunSight   = player.WeaponController().HeldWeaponAgent.CanWeaponSight;
            ArchorPitch         = YawPitchUtility.Normalize(player.cameraArchor.ArchorEulerAngle.x);
            ArchorYaw           = YawPitchUtility.Normalize(player.cameraArchor.ArchorEulerAngle.y);
            IsParachuteAttached = player.hasPlayerSkyMove && player.playerSkyMove.IsParachuteAttached;
            LastViewByOrder     = player.gamePlay.LastViewModeByCmd;
            RoleId              = player.playerInfo.RoleModelId;
            LockViewByRoom      = lockView;
            ModelLoaded         = player.hasFirstPersonModel && player.hasThirdPersonModel;
            IsVariant           = JudgeVariant(player);
        }
Esempio n. 2
0
        public void Generate(Contexts contexts, PlayerEntity player, IUserCmd usercmd, float archorYaw, float archorPitch, ICameraMotorState state)
        {
            var speedRatio = CameraUtility.GetGunSightSpeed(player, state);

            DeltaYaw   = usercmd.DeltaYaw * speedRatio;
            DeltaPitch = usercmd.DeltaPitch * speedRatio;
            if (usercmd.FilteredInput != null)
            {
                IsCameraFree         = usercmd.FilteredInput.IsInput(EPlayerInput.IsCameraFree);
                FilteredChangeCamera = usercmd.FilteredInput.IsInput(EPlayerInput.ChangeCamera);
                FilteredCameraFocus  = usercmd.FilteredInput.IsInput(EPlayerInput.IsCameraFocus);
            }
            var controller = player.WeaponController();

            FrameInterval = usercmd.FrameInterval;
            ChangeCamera  = usercmd.ChangeCamera;

            IsCameraFocus = usercmd.IsCameraFocus;

            IsCmdRun            = usercmd.IsRun;
            IsCmdMoveVertical   = usercmd.MoveVertical > 0;
            CurrentPostureState = player.stateInterface.State.GetCurrentPostureState();
            NextPostureState    = player.stateInterface.State.GetNextPostureState();
            LeanState           = player.stateInterface.State.GetNextLeanState();
            IsAirPlane          = player.gamePlay.GameState == GameState.AirPlane;
            ActionState         = player.stateInterface.State.GetActionState();
            ActionKeepState     = player.stateInterface.State.GetActionKeepState();
            IsDriveCar          = player.IsOnVehicle();
            IsDead              = player.gamePlay.IsLifeState(EPlayerLifeState.Dead);
            CanWeaponGunSight   = controller.HeldWeaponAgent.CanWeaponSight;
            ArchorPitch         = YawPitchUtility.Normalize(archorPitch);
            ArchorYaw           = YawPitchUtility.Normalize(archorYaw);
            IsParachuteAttached = player.hasPlayerSkyMove && player.playerSkyMove.IsParachuteAttached;
            if (player.gamePlay.CameraEntityId == 0)
            {
                IsObservingFreemove = false;
            }
            else
            {
                IsObservingFreemove = null != contexts.freeMove.GetEntityWithEntityKey(new EntityKey(player.gamePlay.CameraEntityId, (short)EEntityType.FreeMove));
            }
            InterruptCameraFocus = usercmd.IsUseAction || usercmd.IsTabDown;
            LastViewByOrder      = player.gamePlay.LastViewModeByCmd;
        }