Пример #1
0
        public void ContainerSystemSet(Entity entity, int index)
        {
            var cached = GetCachedEntity(entity);

            for (int i = 0; i < _array.ArrayCount; i++)
            {
                if (_array[i] == cached)
                {
                    _array.Remove(i);
                }
            }
            _array.Set(index, cached);
        }
Пример #2
0
 public void OnSystemUpdate(float dt)
 {
     if (_timerArray.UsedCount == 0)
     {
         return;
     }
     foreach (TagTimerEvent timer in _timerArray)
     {
         if (timer.TimeEnd > TimeManager.Time)
         {
             continue;
         }
         timer.Entity.Tags.Remove(timer.Tag);
         timer.Entity.Post(new TagChangeEvent(timer.Entity, timer.Tag, false));
         switch (timer.Tag)
         {
         case EntityTags.IsConfused:
             if (EntityCount(timer.Entity, timer.Tag) <= 1)
             {
                 timer.Entity.Post(new ConfusionEvent(timer.Entity, 0, false));
             }
             break;
         }
         _timerArray.Remove(timer);
     }
 }
Пример #3
0
 public bool Remove(Entity entity)
 {
     if (!Contains(entity))
     {
         return(false);
     }
     _array.Remove(entity);
     if (_entityLookup.TryGetValue(entity, out var cached))
     {
         _cachePool.Store(cached);
         _entityLookup.Remove(entity);
     }
     ProcessEntityRemoval(entity);
     OnRefreshItemList.SafeInvoke();
     return(true);
 }