Ejemplo n.º 1
0
        public void Deactivate()
        {
            if (m_effect2entity.Count == 0)
            {
                return;
            }

            LogicWorld    logic_world    = m_generator.GetLogicWorld();
            EntityManager entity_manager = logic_world.GetEntityManager();

            SortedDictionary <int, int> temp = m_effect2entity;

            m_effect2entity = null;
            var enumerator = temp.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Entity         entity   = entity_manager.GetObject(enumerator.Current.Value);
                EffectRegistry registry = EntityUtil.GetEffectRegistry(entity);
                if (registry != null)
                {
                    registry.RemoveEffect(enumerator.Current.Key);
                }
            }

            temp.Clear();
            m_effect2entity = temp;
        }
Ejemplo n.º 2
0
        public override void Run(LogicWorld logic_world, FixPoint current_time, FixPoint delta_time)
        {
            Entity entity = logic_world.GetEntityManager().GetObject(m_entity_id);

            if (entity == null)
            {
                return;
            }
            EffectRegistry registry = EntityUtil.GetEffectRegistry(entity);

            if (registry == null)
            {
                return;
            }
            Effect effect = registry.GetEffect(m_effect_id);

            if (effect == null)
            {
                return;
            }
            EffectDefinitionComponent definition_cmp = effect.GetDefinitionComponent();

            if (definition_cmp.ExpirationTime > logic_world.GetCurrentTime())
            {
                return;
            }
            registry.RemoveEffect(m_effect_id);
        }
Ejemplo n.º 3
0
        void ActivateOnOneTatget(EffectApplicationData app_data, Entity target)
        {
            EffectRegistry registry = EntityUtil.GetEffectRegistry(target);

            if (registry == null)
            {
                return;
            }
            if (!registry.CanAddEffect())
            {
                return;
            }
            Effect effect = CreateEffect(target.ID);

            if (effect == null)
            {
                return;
            }
            app_data.m_target_entity_id = target.ID;
            app_data.m_generator_id     = m_generator.ID;
            app_data.m_entry_index      = m_index;
            EffectDefinitionComponent definition_cmp = effect.GetDefinitionComponent();

            definition_cmp.InitializeApplicationData(app_data);
            if (!registry.AddEffect(effect))
            {
                m_generator.GetLogicWorld().GetEffectManager().DestroyObject(effect.ID);
            }
            else
            {
                m_effect2entity[effect.ID] = target.ID;
            }
        }
Ejemplo n.º 4
0
 protected override void OnDestruct()
 {
     m_generator_registry.Destruct();
     m_generator_registry = null;
     m_effect_registry.Destruct();
     m_effect_registry = null;
 }
Ejemplo n.º 5
0
        public override void Run(LogicWorld logic_world, FixPoint current_time, FixPoint delta_time)
        {
            Entity entity = logic_world.GetEntityManager().GetObject(m_entity_id);

            if (entity == null)
            {
                return;
            }
            EffectRegistry registry = EntityUtil.GetEffectRegistry(entity);

            if (registry == null)
            {
                return;
            }
            registry.RemoveEffect(m_effect_id);
            LogicTask.Recycle(this);
        }
 public void Destruct()
 {
     m_registry = null;
     m_category = null;
     m_active_effects.Clear();
 }
 public ClassifiedEffectContainer(EffectRegistry registry, EffectCategoryData category)
 {
     m_registry = registry;
     m_category = category;
 }
Ejemplo n.º 8
0
 public EffectManagerComponent()
 {
     m_generator_registry = new EffectGeneratorRegistry(this);
     m_effect_registry    = new EffectRegistry(this);
 }