コード例 #1
0
ファイル: ECSEvent.cs プロジェクト: skolwind/BrokenBricksECS
        public void Subscribe(ref Entity entity, IComponentRemovedFromEntityEventListener eventListener)
        {
            List <IComponentRemovedFromEntityEventListener> eventListeners;

            if (!eventListenerMap.TryGetValue(entity, out eventListeners))
            {
                eventListeners = new List <IComponentRemovedFromEntityEventListener>();
                eventListenerMap.Add(entity, eventListeners);
            }
            eventListeners.Add(eventListener);
        }
コード例 #2
0
ファイル: ECSEvent.cs プロジェクト: skolwind/BrokenBricksECS
        public void Unsubscribe(ref Entity entity, IComponentRemovedFromEntityEventListener eventListener)
        {
            List <IComponentRemovedFromEntityEventListener> eventListeners;

            if (eventListenerMap.TryGetValue(entity, out eventListeners))
            {
                eventListeners.Remove(eventListener);
                if (eventListeners.Count == 0)
                {
                    eventListenerMap.Remove(entity);
                }
            }
        }
コード例 #3
0
 public void UnsubscribeOnComponentRemovedFromEntity(IComponentRemovedFromEntityEventListener eventListener)
 {
     _componentRemovedFromEntityEvent.Unsubscribe(eventListener);
 }
コード例 #4
0
 public void SubscribeOnComponentRemovedFromEntity(Entity entity, IComponentRemovedFromEntityEventListener eventListener)
 {
     _componentRemovedFromEntityEvent.Subscribe(ref entity, eventListener);
 }
コード例 #5
0
 public void UnsubscribeOnComponentRemovedFromEntity <TComponent>(IComponentRemovedFromEntityEventListener <TComponent> eventListener) where TComponent : IComponent
 {
     GetComponentMap <TComponent>(true).UnsubscribeOnComponentRemovedFromEntity(eventListener);
 }
コード例 #6
0
 public void SubscribeOnComponentRemovedFromEntity <TComponent>(Entity entity, IComponentRemovedFromEntityEventListener <TComponent> eventListener) where TComponent : IComponent
 {
     GetComponentMap <TComponent>(true).SubscribeOnComponentRemovedFromEntity(entity, eventListener);
 }
コード例 #7
0
 public void UnsubscripeOnComponentRemovedFromEntity(Entity entity, IComponentRemovedFromEntityEventListener eventListener)
 {
     _componentRemovedFromEntityEvent.Unsubscripe(ref entity, eventListener);
 }