private void CalcFinalOutput(PlayerEntity player, DummyCameraMotorInput input, CameraStateOutputNewComponent finalOutput, DummyCameraMotorState state) { player.cameraConfigNow.Config = state.GetMainConfig(); player.cameraConfigNow.PeekConfig = SingletonManager.Get <CameraConfigManager>().Config.PeekConfig; player.cameraConfigNow.DeadConfig = SingletonManager.Get <CameraConfigManager>().Config.DeadConfig; _output.Init(); _output.ArchorPosition = player.cameraArchor.ArchorPosition + player.cameraArchor.ArchorTransitionOffsetPosition; _output.ArchorEulerAngle = player.cameraArchor.ArchorEulerAngle; for (int i = 0; i < (int)SubCameraMotorType.End; i++) { var type = (SubCameraMotorType)i; _output.Append(CalcSubFinalCamera(player, input, state, _motors.GetDict(type), state.Get(type), player.time.ClientTime)); } finalOutput.ArchorPosition = _output.ArchorPosition; finalOutput.ArchorEulerAngle = _output.ArchorEulerAngle; finalOutput.ArchorOffset = _output.ArchorOffset; finalOutput.ArchorPostOffset = _output.ArchorPostOffset; finalOutput.EulerAngle = _output.EulerAngle; finalOutput.Offset = _output.Offset; finalOutput.PostOffset = _output.PostOffset; finalOutput.Fov = _output.Fov; finalOutput.Far = _output.Far; finalOutput.Near = _output.Near; SmoothFov(player); }
public static Motors CraeteMotors(Contexts contexts, CameraConfig config) { Motors motors = new Motors(); var pose = motors.GetDict(SubCameraMotorType.Pose); // config.GetCameraConfigItem(ECameraViewMode.ThirdPerson) pose[(int)ECameraPoseMode.Stand] = new NormalPoseMotor(ECameraPoseMode.Stand, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new ThirdPersonActice()); pose[(int)ECameraPoseMode.Crouch] = new NormalPoseMotor(ECameraPoseMode.Crouch, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new CrouchActice()); pose[(int)ECameraPoseMode.Prone] = new NormalPoseMotor(ECameraPoseMode.Prone, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new ProneActice()); pose[(int)ECameraPoseMode.Swim] = new NormalPoseMotor(ECameraPoseMode.Swim, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new SwimActice()); pose[(int)ECameraPoseMode.Dying] = new NormalPoseMotor(ECameraPoseMode.Dying, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new DyingActice()); pose[(int)ECameraPoseMode.Dead] = new DeadPoseMotor(ECameraPoseMode.Dead, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new DeadActice(), config.DeadConfig); pose[(int)ECameraPoseMode.Parachuting] = new NormalPoseMotor(ECameraPoseMode.Parachuting, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new ParachutingActice()); pose[(int)ECameraPoseMode.ParachutingOpen] = new NormalPoseMotor(ECameraPoseMode.ParachutingOpen, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new ParachutingOpenActice()); pose[(int)ECameraPoseMode.Gliding] = new GlidingPoseMotor(ECameraPoseMode.Gliding, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new GlidingActice()); pose[(int)ECameraPoseMode.DriveCar] = new DrivePoseMotor(ECameraPoseMode.DriveCar, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), contexts.vehicle, contexts.freeMove); pose[(int)ECameraPoseMode.AirPlane] = new AirplanePoseMotor(ECameraPoseMode.AirPlane, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), contexts.vehicle, contexts.freeMove); pose[(int)ECameraPoseMode.Climb] = new NormalPoseMotor(ECameraPoseMode.Climb, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new ClimbActive()); pose[(int)ECameraPoseMode.Rescue] = new NormalPoseMotor(ECameraPoseMode.Rescue, config, new HashSet <ECameraPoseMode>(CommonIntEnumEqualityComparer <ECameraPoseMode> .Instance), new RescueActive()); var free = motors.GetDict(SubCameraMotorType.Free); free[(int)ECameraFreeMode.On] = new FreeOnMotor(); free[(int)ECameraFreeMode.Off] = new FreeOffMotor(config.FreeConfig.TransitionTime); var peek = motors.GetDict(SubCameraMotorType.Peek); peek[(int)ECameraPeekMode.Off] = new PeekOffMotor(config.PeekConfig.TransitionTime); peek[(int)ECameraPeekMode.Left] = new PeekOnMotor(false, config.PeekConfig); peek[(int)ECameraPeekMode.Right] = new PeekOnMotor(true, config.PeekConfig); var view = motors.GetDict(SubCameraMotorType.View); view[(int)ECameraViewMode.FirstPerson] = new FirstViewMotor(); view[(int)ECameraViewMode.GunSight] = new GunSightMotor(contexts); view[(int)ECameraViewMode.ThirdPerson] = new ThirdViewMotor(); CameraActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.Pose, (int)ECameraPoseMode.Parachuting, (player, state) => { var cameraEulerAngle = player.cameraFinalOutputNew.EulerAngle; var carEulerAngle = player.cameraArchor.ArchorEulerAngle; var t = cameraEulerAngle - carEulerAngle; state.FreeYaw = t.y; state.FreePitch = t.x; }); return(motors); }
private void RestoreSelfPlayer(PlayerEntity player) { var dict = _motors.GetDict(SubCameraMotorType.View); var subState = _state.Get(SubCameraMotorType.View); var oldMotor = dict[subState.NowMode]; if (oldMotor.ModeId != (short)ECameraViewMode.ThirdPerson) { subState.NowMode = (byte)ECameraViewMode.ThirdPerson; subState.LastMode = (byte)ECameraViewMode.FirstPerson; _motors.ActionManager.SetActionCode(CameraActionType.Leave, SubCameraMotorType.View, oldMotor.ModeId); _motors.ActionManager.SetActionCode(CameraActionType.Enter, SubCameraMotorType.View, (int)ECameraViewMode.ThirdPerson); _motors.ActionManager.OnAction(player, _state); } }