Пример #1
0
        public void InitParam(ProjectileParameters param)
        {
            m_param = param;
            if (m_trajectory_type == TrajectoryTypeBezier)
            {
                m_param.m_bezier_b    = (m_param.m_start_position + m_param.m_target_position) / FixPoint.Two;
                m_param.m_bezier_b.y += m_extra_hight;
            }
            if (m_param.m_life_time <= FixPoint.Zero)
            {
                m_param.m_life_time = m_life_time;
            }

            PositionComponent position_component = ParentObject.GetComponent(PositionComponent.ID) as PositionComponent;
            GridGraph         grid_graph         = position_component.GetGridGraph();
            GridNode          node = grid_graph.Position2Node(position_component.CurrentPosition);

            m_previous_walkable = (node != null && node.Walkable);

            if (m_task == null)
            {
                m_task = LogicTask.Create <UpdateProjectileTask>();
            }
            m_task.Construct(this, m_param.m_life_time);
            var schedeler = GetLogicWorld().GetTaskScheduler();

            schedeler.Schedule(m_task, GetCurrentTime(), LOGIC_UPDATE_INTERVAL, LOGIC_UPDATE_INTERVAL);

#if COMBAT_CLIENT
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(ParentObject.ID, true);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
        public override void Apply()
        {
            if (m_task == null)
            {
                m_task = LogicTask.Create <ComponentCommonTaskWithLastingTime>();
            }

            EffectDefinitionComponent definition_component = ((Effect)ParentObject).GetDefinitionComponent();
            Entity entity = GetLogicWorld().GetEntityManager().GetObject(definition_component.SourceEntityID);

            if (entity != null)
            {
                PositionComponent position_component = entity.GetComponent(PositionComponent.ID) as PositionComponent;
                if (position_component != null)
                {
                    m_direction = position_component.Facing3D;
                }
            }
            m_task.Construct(this, m_time);
            var schedeler = GetLogicWorld().GetTaskScheduler();

            schedeler.Schedule(m_task, GetCurrentTime(), LOGIC_UPDATE_INTERVAL, LOGIC_UPDATE_INTERVAL);
#if COMBAT_CLIENT
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(GetOwnerEntityID(), true, LocomoteRenderMessage.NotLocomotion);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
Пример #3
0
        protected void OnMovementStarted(bool from_command)
        {
            ParentObject.SendSignal(SignalType.StartMoving);
#if COMBAT_CLIENT
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(ParentObject.ID, IsAnimationBlocked, from_command ? 0 : LocomoteRenderMessage.NotFromCommand);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
Пример #4
0
        public void UnblockAnimation()
        {
            --m_animation_block_cnt;
#if COMBAT_CLIENT
            if (m_animation_block_cnt == 0 && m_is_moving)
            {
                LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
                msg.ConstructAsStartMoving(ParentObject.ID, IsAnimationBlocked, LocomoteRenderMessage.UnblockAnimation);
                GetLogicWorld().AddRenderMessage(msg);
            }
#endif
        }
Пример #5
0
        protected override void OnActionUpdate(FixPoint delta_time)
        {
            LogicWorld logic_world = GetLogicWorld();
            var        schedeler   = logic_world.GetTaskScheduler();

            schedeler.Schedule(m_task, logic_world.GetCurrentTime(), LOGIC_UPDATE_INTERVAL, LOGIC_UPDATE_INTERVAL);
            m_remain_time = m_time;
#if COMBAT_CLIENT
            Skill skill = GetOwnerSkill();
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(skill.GetOwnerEntityID(), true, LocomoteRenderMessage.NotLocomotion);
            GetLogicWorld().AddRenderMessage(msg);
#endif
        }
Пример #6
0
        public override void Inflict(FixPoint start_time)
        {
            Skill owner_skill = GetOwnerSkill();
            SkillDefinitionComponent definition_component = owner_skill.GetDefinitionComponent();

            m_actual_distance = m_distance;
            if (m_distance == FixPoint.Zero)
            {
                if (definition_component.ExternalDataType == SkillDefinitionComponent.NeedExternalOffset)
                {
                    m_actual_distance = definition_component.ExternalVector.Length();
                }
            }
            m_actual_time = m_time;
            if (definition_component.NormalAttack)
            {
                m_actual_time = m_time / owner_skill.GetSkillManagerComponent().AttackSpeedRate;
            }

            if (m_task == null)
            {
                m_task = LogicTask.Create <ComponentCommonTaskWithLastingTime>();
            }
            m_task.Construct(this, m_actual_time);
            var schedeler = GetLogicWorld().GetTaskScheduler();

            schedeler.Schedule(m_task, GetCurrentTime(), LOGIC_UPDATE_INTERVAL, LOGIC_UPDATE_INTERVAL);
#if COMBAT_CLIENT
            LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
            msg.ConstructAsStartMoving(GetOwnerEntityID(), true, LocomoteRenderMessage.NotLocomotion);
            GetLogicWorld().AddRenderMessage(msg);
#endif

            if (m_enable_hide)
            {
                GetLogicWorld().AddSimpleRenderMessage(RenderMessageType.Hide, GetOwnerEntityID());
            }
        }