public void Subscribe(ref Entity entity, IComponentRemovingFromEntityEventListener eventListener) { List <IComponentRemovingFromEntityEventListener> eventListeners; if (!eventListenerMap.TryGetValue(entity, out eventListeners)) { eventListeners = new List <IComponentRemovingFromEntityEventListener>(); eventListenerMap.Add(entity, eventListeners); } eventListeners.Add(eventListener); }
public void Unsubscribe(ref Entity entity, IComponentRemovingFromEntityEventListener eventListener) { List <IComponentRemovingFromEntityEventListener> eventListeners; if (eventListenerMap.TryGetValue(entity, out eventListeners)) { eventListeners.Remove(eventListener); if (eventListeners.Count == 0) { eventListenerMap.Remove(entity); } } }
public void UnsubscribeOnComponentRemovingFromEntity(IComponentRemovingFromEntityEventListener eventListener) { _componentRemovingFromEntityEvent.Unsubscribe(eventListener); }
public void SubscribeOnComponentRemovingFromEntity(Entity entity, IComponentRemovingFromEntityEventListener eventListener) { _componentRemovingFromEntityEvent.Subscribe(ref entity, eventListener); }
public void UnsubscribeOnComponentRemovingFromEntity <TComponent>(IComponentRemovingFromEntityEventListener <TComponent> eventListener) where TComponent : IComponent { GetComponentMap <TComponent>(true).UnsubscribeOnComponentRemovingFromEntity(eventListener); }
public void SubscribeOnComponentRemovingFromEntity <TComponent>(Entity entity, IComponentRemovingFromEntityEventListener <TComponent> eventListener) where TComponent : IComponent { GetComponentMap <TComponent>(true).SubscribeOnComponentRemovingFromEntity(entity, eventListener); }