Пример #1
0
        protected virtual void PredictCommand(Command cmd)
        {
            RenderEntity render_entity = m_render_entity_manager.GetObject(cmd.m_entity_id);

            if (render_entity == null)
            {
                return;
            }
            PredictLogicComponent predict_logic_component = render_entity.GetComponent(PredictLogicComponent.ID) as PredictLogicComponent;

            if (predict_logic_component == null)
            {
                return;
            }
            predict_logic_component.PredictCommand(cmd);
        }
        void ProcessRenderMessage_StartMoving(LocomoteRenderMessage msg)
        {
            RenderEntity render_entity = m_render_entity_manager.GetObject(msg.EntityID);

            if (render_entity == null)
            {
                return;
            }
            ModelComponent model_component = render_entity.GetComponent(ModelComponent.ID) as ModelComponent;

            if (model_component == null)
            {
                return;
            }
            m_render_world.RegisterMovingEntity(model_component);
            PredictLogicComponent predic_component = render_entity.GetComponent(PredictLogicComponent.ID) as PredictLogicComponent;

            if (msg.m_reason == LocomoteRenderMessage.NotLocomotion || msg.m_block_animation)
            {
                model_component.UpdateAngle();
                if (predic_component != null)
                {
                    predic_component.OnLogicMove();
                }
            }
            else if (msg.m_reason == LocomoteRenderMessage.NotFromCommand)
            {
                model_component.UpdateAngle();
                PlayLocomotorAnimation(render_entity);
                if (predic_component != null)
                {
                    predic_component.OnLogicMove();
                }
            }
            else if (msg.m_reason == LocomoteRenderMessage.UnblockAnimation)
            {
                model_component.UpdateAngle();
                PlayLocomotorAnimation(render_entity);
            }
            else if (predic_component == null || !predic_component.HasMovementPredict)
            {
                model_component.UpdateAngle();
                PlayLocomotorAnimation(render_entity);
            }
        }