Exemplo n.º 1
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);
            }
        }