Exemplo n.º 1
0
        public void ExecuteUserCmd(IUserCmdOwner owner, IUserCmd cmd)
        {
            PlayerEntity playerEntity = (PlayerEntity)owner.OwnerEntity;

            if (playerEntity.gamePlay.IsLifeState(EPlayerLifeState.Dead) || playerEntity.gamePlay.IsLastLifeState(EPlayerLifeState.Dead))
            {
                // gamePlay有对应的处理,这里不需要
                return;
            }

            var stateManager = playerEntity.stateInterface.State;

            ComponentSynchronizer.SyncFromStateInterVarComponent(playerEntity.stateInterVar, stateManager);
            ComponentSynchronizer.SyncFromStateComponent(playerEntity.state, stateManager);
            stateManager.ServerUpdate();
            _fsmOutputs.ResetOutput();
            ConverntToFsmOutCommand(playerEntity.stateInterVar.StateInterCommands);
            _fsmOutputs.SetOutput(playerEntity);
            stateManager.HandleAnimationCallback(playerEntity.stateInterVar.AnimationCallbackCommands.Commands);

            //动画回调
            ProcessAnimationEvent(playerEntity);

            SyncThirdPersonAppearance(playerEntity);
        }
        public void ExecuteUserCmd(IPlayerUserCmdGetter getter, IUserCmd cmd)
        {
            PlayerEntity playerEntity = (PlayerEntity)getter.OwnerEntity;

            CheckPlayerLifeState(playerEntity);

            var stateManager = playerEntity.stateInterface.State;

            ComponentSynchronizer.SyncFromStateInterVarComponent(playerEntity.stateInterVar, stateManager);
            ComponentSynchronizer.SyncFromStateComponent(playerEntity.state, stateManager);
            stateManager.ServerUpdate();
            _fsmOutputs.ResetOutput();
            ConverntToFsmOutCommand(playerEntity.stateInterVar.StateInterCommands);
            _fsmOutputs.SetOutput(playerEntity);
            stateManager.HandleAnimationCallback(playerEntity.stateInterVar.AnimationCallbackCommands.Commands);

            //动画回调
            ProcessAnimationEvent(playerEntity);

            SyncThirdPersonAppearance(playerEntity);
        }