public void Explode(Entity entity)
        {
#if COMBAT_CLIENT
            if (m_collision_sound_cfgid > 0)
            {
                PlaySoundMessage sound_msg = RenderMessage.Create <PlaySoundMessage>();
                sound_msg.Construct(GetOwnerEntityID(), m_collision_sound_cfgid, FixPoint.MinusOne);
                GetLogicWorld().AddRenderMessage(sound_msg);
            }
#endif

            ApplyGenerator(entity);

            if (entity == null || !m_pierce_entity)
            {
#if COMBAT_CLIENT
                LocomoteRenderMessage msg = RenderMessage.Create <LocomoteRenderMessage>();
                msg.ConstructAsStopMoving(ParentObject.ID, true);
                GetLogicWorld().AddRenderMessage(msg);
#endif
                if (m_task != null)
                {
                    m_task.Cancel();
                    LogicTask.Recycle(m_task);
                    m_task = null;
                }
                EntityUtil.KillEntity((Entity)ParentObject, ParentObject.ID);
            }
        }
        void ChangeHealth(FixPoint delta_health, int source_id)
        {
            if (delta_health > 0)
            {
                if (m_current_health + delta_health > m_current_max_health)
                {
                    delta_health = m_current_max_health - m_current_health;
                }
            }
            else
            {
                if (-delta_health > m_current_health)
                {
                    delta_health = -m_current_health;
                }
            }
            if (delta_health == 0)
            {
                return;
            }

            m_current_health += delta_health;

#if COMBAT_CLIENT
            ChangeHealthRenderMessage msg = RenderMessage.Create <ChangeHealthRenderMessage>();
            msg.Construct(ParentObject.ID, delta_health, m_current_health);
            GetLogicWorld().AddRenderMessage(msg);
#endif

            if (m_current_health <= 0)
            {
                EntityUtil.KillEntity(ParentObject as Entity, source_id);
            }
        }
示例#3
0
 void OnMasterDie(Entity master)
 {
     if (master.ID != m_master_id)
     {
         return;
     }
     master.RemoveListener(SignalType.Die, m_listener_context.ID);
     m_master_id = 0;
     EntityUtil.KillEntity((Entity)ParentObject, ParentObject.ID);
 }
        public override void Apply()
        {
            Entity owner = GetOwnerEntity();

            if (owner == null)
            {
                return;
            }
            EntityUtil.KillEntity(owner, owner.ID);
        }
示例#5
0
        public override void Inflict(FixPoint start_time)
        {
            Skill         skill       = GetOwnerSkill();
            List <Target> targets     = skill.GetTargets();
            LogicWorld    logic_world = GetLogicWorld();

            for (int i = 0; i < targets.Count; ++i)
            {
                m_current_target = targets[i].GetEntity(logic_world);
                if (m_current_target == null)
                {
                    continue;
                }
                EntityUtil.KillEntity(m_current_target, GetOwnerEntityID());
            }
            m_current_target = null;
        }
示例#6
0
        protected override void OnActionUpdate(FixPoint delta_time)
        {
            SkillComponent skill_component = m_context.GetData <SkillComponent>(BTContextKey.OwnerSkillComponent);
            Skill          skill           = skill_component.GetOwnerSkill();

            List <Target> targets     = skill.GetTargets();
            LogicWorld    logic_world = GetLogicWorld();

            for (int i = 0; i < targets.Count; ++i)
            {
                Entity current_target = targets[i].GetEntity(logic_world);
                if (current_target == null)
                {
                    continue;
                }
                skill_component.CurrentTarget = current_target;
                EntityUtil.KillEntity(current_target, skill.GetOwnerEntityID());
            }
            skill_component.CurrentTarget = null;
        }