Esempio n. 1
0
        public void DestroyGenerator(int generator_id, int owner_entity_id)
        {
            EffectGenerator generator;

            if (!m_generators.TryGetValue(generator_id, out generator))
            {
                return;
            }
            if (generator.RemoveBySelf && !generator.RemoveSelfWhenIdle)
            {
                generator.RemoveSelfWhenIdle = true;
            }
            else
            {
                generator.ForceDeactivate();
                m_generators.Remove(generator_id);
                Entity owner = m_logic_world.GetEntityManager().GetObject(owner_entity_id);
                EffectGeneratorRegistry registry = EntityUtil.GetEffectGeneratorRegistry(owner);
                if (registry != null)
                {
                    registry.RemoveGenerator(generator_id);
                }
                RecyclableObject.Recycle(generator);
            }
        }
Esempio n. 2
0
 protected override void OnDestruct()
 {
     m_generator_registry.Destruct();
     m_generator_registry = null;
     m_effect_registry.Destruct();
     m_effect_registry = null;
 }
Esempio n. 3
0
        public EffectGenerator CreateGenerator(int generator_id, Entity owner)
        {
            IConfigProvider     config_provider = m_logic_world.GetConfigProvider();
            EffectGeneratorData data            = config_provider.GetEffectGeneratorData(generator_id);

            if (data == null)
            {
                return(null);
            }
            int             id        = m_generator_id_generator.GenID();
            EffectGenerator generator = RecyclableObject.Create <EffectGenerator>();

            generator.Construct(m_logic_world, id, data);
            m_generators[id] = generator;
            EffectGeneratorRegistry registry = EntityUtil.GetEffectGeneratorRegistry(owner);

            if (registry != null)
            {
                registry.AddGenerator(generator);
            }
            return(generator);
        }
Esempio n. 4
0
 public EffectManagerComponent()
 {
     m_generator_registry = new EffectGeneratorRegistry(this);
     m_effect_registry    = new EffectRegistry(this);
 }