Exemplo n.º 1
0
        private void UpdateCamera(IUserCmdOwner owner, IUserCmd cmd)
        {
            PlayerEntity player = owner.OwnerEntity as PlayerEntity;

            if (!player.hasCameraStateNew)
            {
                return;
            }
            if (!player.hasCameraStateOutputNew)
            {
                return;
            }
//            var finalOutput = player.cameraStateOutputNew;
            DummyCameraMotorState.Convert(player.cameraStateNew, _state);


            var archotRotation = player.cameraArchor.ArchorEulerAngle;

            if (player.cameraStateNew.CameraMotorInput == null)
            {
                player.cameraStateNew.CameraMotorInput = new DummyCameraMotorInput();
            }
            DummyCameraMotorInput _input = (DummyCameraMotorInput)player.cameraStateNew.CameraMotorInput;

            _input.Generate(player, cmd, archotRotation.y, archotRotation.x);
            foreach (SubCameraMotorType i in _subCameraMotorTypeArray)
            {
                var type = i;
                PreProcessInput(player, _input, _motors.GetDict(type), _state.Get(type), _state);
            }

            DummyCameraMotorState.Convert(_state, player.cameraStateNew);
        }
Exemplo n.º 2
0
        private void Handle(PlayerEntity player, IUserCmd cmd)
        {
            if (!player.hasCameraStateNew)
            {
                return;
            }
            if (!player.hasCameraStateOutputNew)
            {
                return;
            }

            DummyCameraMotorState.Convert(player.cameraStateNew, _state);

            var archotRotation = player.cameraArchor.ArchorEulerAngle;

            if (player.cameraStateNew.CameraMotorInput == null)
            {
                player.cameraStateNew.CameraMotorInput = new DummyCameraMotorInput();
            }
            DummyCameraMotorInput _input = (DummyCameraMotorInput)player.cameraStateNew.CameraMotorInput;

            _input.Generate(_contexts, player, cmd, archotRotation.y, archotRotation.x, _state);

            for (int i = 0; i < (int)SubCameraMotorType.End; i++)
            {
                var type = (SubCameraMotorType)i;
                PreProcessInput(player, _input, _motors.GetDict(type), _state.Get(type), _state);
            }
            DummyCameraMotorState.Convert(_state, player.cameraStateNew);
        }
Exemplo n.º 3
0
        private void Handle(PlayerEntity player, IUserCmd cmd)
        {
            if (!player.hasCameraStateNew)
            {
                return;
            }
            if (!player.hasCameraStateOutputNew)
            {
                return;
            }
            if (player.cameraStateNew.CameraMotorInput == null)
            {
                player.cameraStateNew.CameraMotorInput = new DummyCameraMotorInput();
            }

            DummyCameraMotorState.Convert(player.cameraStateNew, _state);
            DummyCameraMotorInput _input = (DummyCameraMotorInput)player.cameraStateNew.CameraMotorInput;

            _input.Generate(player, cmd, _state, LockView);

            for (int i = 0; i < (int)SubCameraMotorType.End; i++)
            {
                var type = (SubCameraMotorType)i;
                PreProcessInput(player, _input, _motors.GetDict(type), _state.Get(type), _state);
            }

            DummyCameraMotorState.Convert(_state, player.cameraStateNew);
        }
Exemplo n.º 4
0
        protected override void InternalExecute()
        {
            var player = _playerContext.flagSelfEntity;

            if (player == null)
            {
                return;
            }
            if (!player.hasFirstPersonModel)
            {
                return;
            }
            if (!player.hasThirdPersonModel)
            {
                return;
            }
            if (!player.hasUserCmd)
            {
                return;
            }
            if (player.userCmd.UserCmdStepList.Count == 0)
            {
                return;
            }
            if (!player.hasCameraStateNew)
            {
                return;
            }
            if (!player.hasCameraStateOutputNew)
            {
                return;
            }

            var cmd = (UserCmd)player.userCmd.UserCmdStepList.Last();

            DummyCameraMotorState.Convert(player.cameraStateNew, _state);
            var archotRotation = player.cameraArchor.ArchorEulerAngle;

            _input.Generate(player, cmd, archotRotation.y, archotRotation.x);

            foreach (int i in _subCameraMotorTypeArray)
            {
                var type = (SubCameraMotorType)i;
                PreProcessInput(player, _input, _motors.GetDict(type), _state.Get(type), _state);
            }
            DummyCameraMotorState.Convert(_state, player.cameraStateNew);
        }
Exemplo n.º 5
0
        private void UpdateCamera(IUserCmdOwner owner, IUserCmd cmd)
        {
            PlayerEntity player = owner.OwnerEntity as PlayerEntity;

            if (!player.hasCameraStateNew)
            {
                return;
            }
            if (!player.hasCameraStateOutputNew)
            {
                return;
            }

            //观战玩家时,摄像机方向由被观战玩家决定
            if (player.gamePlay.IsObserving())
            {
                int objId  = player.gamePlay.CameraEntityId;
                var entity = _contexts.player.GetEntityWithEntityKey(new EntityKey(objId, (short)EEntityType.Player));
                if (entity != null)
                {
                    return;
                }
            }

            DummyCameraMotorState.Convert(player.cameraStateNew, _state);

            var archotRotation = player.cameraArchor.ArchorEulerAngle;

            if (player.cameraStateNew.CameraMotorInput == null)
            {
                player.cameraStateNew.CameraMotorInput = new DummyCameraMotorInput();
            }
            DummyCameraMotorInput _input = (DummyCameraMotorInput)player.cameraStateNew.CameraMotorInput;

            _input.Generate(_contexts, player, cmd, archotRotation.y, archotRotation.x);

            for (int i = 0; i < (int)SubCameraMotorType.End; i++)
            {
                var type = (SubCameraMotorType)i;
                PreProcessInput(player, _input, _motors.GetDict(type), _state.Get(type), _state);
            }

            DummyCameraMotorState.Convert(_state, player.cameraStateNew);
        }
Exemplo n.º 6
0
 public CameraConfigItem GetMainConfig()
 {
     return(((ICameraMainMotor)_motors.GetDict(SubCameraMotorType.Pose)[GetMainMotor().NowMode]).Config);
 }