Esempio n. 1
0
        public static void Move(PlayerEntity player, IUserCmd cmd, float deltaTime)
        {
            var moveVertical   = cmd.MoveVertical;
            var moveHorizontal = cmd.MoveHorizontal;
            var stage          = player.playerSkyMove.MoveStage;

            if (!SharedConfig.IsServer)
            {
                PlayerSkyMoveStateMachine.GetStates()[stage]
                .Move(player, moveVertical, moveHorizontal, deltaTime);
            }
            else
            {
                PlayerSkyMoveStateMachine.GetStates()[stage]
                .ServerMove(player, moveVertical, moveHorizontal, deltaTime);
            }
        }
Esempio n. 2
0
        public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd)
        {
            PlayerEntity player = (PlayerEntity)owner.OwnerEntity;

            var playerSkyMove = player.playerSkyMove;

            SynFromInterVar(player);
            playerSkyMove.IsMoveEnabled = PlayerSkyMoveState.IsSkyMoveEnabled(player);

            if (playerSkyMove.IsMoveEnabled)
            {
                //var stage = playerSkyMove.MoveStage;
                var stage = playerSkyMove.MoveStage;
                //Logger.InfoFormat("ServerUpdate move enabled!!!playerSkyMove stage:{0}, game state:{1}, seq:{2}",stage, player.gamePlay.GameState, cmd.Seq);
                PlayerSkyMoveStateMachine.GetStates()[(int)stage].ServerUpdate(_contexts, player, cmd);
            }
        }
        public void ExecuteUserCmd(IPlayerUserCmdGetter getter, IUserCmd cmd)
        {
            PlayerEntity player = (PlayerEntity)getter.OwnerEntity;

            var playerSkyMove = player.playerSkyMove;

            SynToInterVar(player);
            playerSkyMove.IsMoveEnabled = PlayerSkyMoveState.IsSkyMoveEnabled(player);
            //Logger.InfoFormat("client move enabled!!!playerSkyMove stage:{0}, game state:{1}, seq:{2}",playerSkyMove.MoveStage, player.gamePlay.GameState, cmd.Seq);

            if (playerSkyMove.IsMoveEnabled)
            {
                var stage = playerSkyMove.MoveStage;
                PlayerSkyMoveStateMachine.GetStates()[(int)stage].Update(_contexts, player, cmd);
            }

            PlayerSkyMoveState.ValidateStateAfterUpdate(_contexts, player);
        }
Esempio n. 4
0
        private void SkyMove(PlayerEntity player, float moveHorizontal, float moveVertical, float deltaTime)
        {
            var stage = player.playerSkyMove.MoveStage;

            if (!SharedConfig.IsServer)
            {
                PlayerSkyMoveStateMachine.GetStates()[(int)stage].Move(player, moveVertical, moveHorizontal, deltaTime);
            }
            else
            {
                PlayerSkyMoveStateMachine.GetStates()[(int)stage].ServerMove(player, moveVertical, moveHorizontal, deltaTime);
            }
            player.skyMoveUpdate.SkyMoveStage           = player.playerSkyMove.MoveStage;
            player.skyMoveUpdate.SkyPosition            = player.playerSkyMove.Position;
            player.skyMoveUpdate.SkyRotation            = player.playerSkyMove.Rotation;
            player.skyMoveUpdate.SkyLocalPlayerPosition = player.playerSkyMove.LocalPlayerPosition;
            player.skyMoveUpdate.SkyLocalPlayerRotation = player.playerSkyMove.LocalPlayerRotation;
            player.skyMoveUpdate.Pitch     = player.orientation.Pitch;
            player.skyMoveUpdate.Yaw       = player.orientation.Yaw;
            player.skyMoveUpdate.Roll      = player.orientation.Roll;
            player.skyMoveUpdate.GameState = player.gamePlay.GameState;
//            player.skyMoveUpdate.IsMoveEnabled = player.playerSkyMove.IsMoveEnabled;
        }