예제 #1
0
 public void CheckIdle()
 {
     if (!m_remove_self_when_idle)
     {
         return;
     }
     for (int i = 0; i < m_entries.Count; ++i)
     {
         if (!m_entries[i].Idle)
         {
             return;
         }
     }
     m_logic_world.GetEffectManager().DestroyGenerator(m_id, 0);
 }
예제 #2
0
        void ApplyGenerator(Entity entity)
        {
            LogicWorld      logic_world = GetLogicWorld();
            EffectGenerator generator   = logic_world.GetEffectManager().GetGenerator(m_param.m_generator_id);

            if (generator == null)
            {
                return;
            }
            EffectApplicationData app_data = RecyclableObject.Create <EffectApplicationData>();

            app_data.m_original_entity_id = m_param.m_source_entity_id;
            app_data.m_source_entity_id   = GetOwnerEntityID();
            generator.Activate(app_data, entity);
            RecyclableObject.Recycle(app_data);
        }
예제 #3
0
        Effect CreateEffect(int target_entity_id)
        {
            LogicWorld      logic_world    = m_generator.GetLogicWorld();
            EffectManager   effect_manager = logic_world.GetEffectManager();
            IConfigProvider config         = logic_world.GetConfigProvider();
            ObjectTypeData  effect_data    = config.GetEffectData(m_data.m_effect_id);

            if (effect_data == null)
            {
                return(null);
            }
            ObjectCreationContext object_context = new ObjectCreationContext();

            //m_object_proxy_id
            object_context.m_object_type_id = m_data.m_effect_id;
            object_context.m_type_data      = effect_data;
            object_context.m_logic_world    = logic_world;
            object_context.m_owner_id       = target_entity_id;
            Effect effect = effect_manager.CreateObject(object_context);

            return(effect);
        }
예제 #4
0
        public ISignalListener GetListener(LogicWorld logic_world)
        {
            switch (m_context_type)
            {
            case SignalListenerContextType.PlayerComponent:
            {
                Player player = logic_world.GetPlayerManager().GetObject(m_object_id);
                if (player == null)
                {
                    return(null);
                }
                Component component = player.GetComponent(m_component_type_id);
                if (component == null)
                {
                    return(null);
                }
                return(component as ISignalListener);
            }

            case SignalListenerContextType.EntityComponent:
            {
                Entity entity = logic_world.GetEntityManager().GetObject(m_object_id);
                if (entity == null)
                {
                    return(null);
                }
                Component component = entity.GetComponent(m_component_type_id);
                if (component == null)
                {
                    return(null);
                }
                return(component as ISignalListener);
            }

            case SignalListenerContextType.EffectComponent:
            {
                Effect effect = logic_world.GetEffectManager().GetObject(m_object_id);
                if (effect == null)
                {
                    return(null);
                }
                Component component = effect.GetComponent(m_component_type_id);
                if (component == null)
                {
                    return(null);
                }
                return(component as ISignalListener);
            }

            case SignalListenerContextType.BehaviorTree:
            {
                BehaviorTree tree = logic_world.GetBehaviorTree(m_object_id);
                if (tree == null)
                {
                    return(null);
                }
                return(tree);
            }

            default:
                return(null);
            }
        }