Exemplo n.º 1
0
        public void CallEvent <TComponent>(object sender, ref Entity entity, ref TComponent component)
        {
            for (int i = 0; i < EventListeners.Count; i++)
            {
                EventListeners[i].OnComponentChangedOfEntity(sender, entity, component);
            }

            List <IComponentChangedOfEntityEventListener> entityEventListeners;

            if (EventListenerMap.TryGetValue(entity, out entityEventListeners))
            {
                for (int i = 0; i < entityEventListeners.Count; i++)
                {
                    entityEventListeners[i].OnComponentChangedOfEntity(sender, entity, component);
                }
            }
        }
Exemplo n.º 2
0
        public void CallEvent(object sender, ref Entity entity, Type componentType)
        {
            for (int i = 0; i < EventListeners.Count; i++)
            {
                EventListeners[i].OnComponentRemovedFromEntity(sender, entity, componentType);
            }

            List <IComponentRemovedFromEntityEventListener> entityEventListeners;

            if (EventListenerMap.TryGetValue(entity, out entityEventListeners))
            {
                for (int i = 0; i < entityEventListeners.Count; i++)
                {
                    entityEventListeners[i].OnComponentRemovedFromEntity(sender, entity, componentType);
                }
            }
        }