void ProcessRenderMessage_ChangePosition(ChangePositionRenderMessage msg)
        {
            RenderEntity render_entity = m_render_entity_manager.GetObject(msg.EntityID);

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

            if (predic_component != null)
            {
                if (msg.m_micro_adjusting && predic_component.HasMovementPredict)
                {
                    return;
                }
                else
                {
                    predic_component.ClearAllPrediction();
                }
            }
            ModelComponent model_component = render_entity.GetComponent <ModelComponent>();

            if (model_component == null)
            {
                return;
            }
            model_component.UpdatePosition();
        }
        void ProcessRenderMessage_StopMoving(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.UnregisterMovingEntity(model_component);
            if (msg.m_block_animation)
            {
                return;
            }
            PredictLogicComponent predic_component = render_entity.GetComponent(PredictLogicComponent.ID) as PredictLogicComponent;

            if (msg.m_reason == LocomoteRenderMessage.NotFromCommand || predic_component == null || !predic_component.HasMovementPredict)
            {
                PlayIdleAnimation(render_entity);
            }
        }
Пример #3
0
        public virtual void OnLogicWorldHandleCommand(Command cmd, bool result)
        {
            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.ConfirmCommand(cmd, result);
        }
Пример #4
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_Hide(int entity_id)
        {
            RenderEntity render_entity = m_render_entity_manager.GetObject(entity_id);

            if (render_entity == null)
            {
                return;
            }
            render_entity.Hide = true;
            PredictLogicComponent predict_component = render_entity.GetComponent <PredictLogicComponent>();

            if (predict_component != null)
            {
                predict_component.ClearAllPrediction();
            }
        }
        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);
            }
        }
        void ProcessRenderMessage_ChangeDirection(ChangeDirectionRenderMessage msg)
        {
            //ZZWTODO 移动动作和朝向
            RenderEntity render_entity = m_render_entity_manager.GetObject(msg.EntityID);

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

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

            if (model_component == null)
            {
                return;
            }
            model_component.UpdateAngle();
        }
Пример #8
0
 public void SetPredictComponent(PredictLogicComponent predict_component)
 {
     m_predict_component = predict_component;
 }
 public override void OnReset()
 {
     m_predict_component   = null;
     m_direction           = Vector3.zero;
     m_remain_predict_time = -1f;
 }
 public void Construct(PredictLogicComponent predict_component, Vector3 direction, float max_predict_time)
 {
     m_predict_component   = predict_component;
     m_direction           = direction;
     m_remain_predict_time = max_predict_time;
 }