Пример #1
0
 public ComponentsPool(ComponentType componentType, ConstructorInfo constructor, int capacity = 32)
 {
     _componentType = componentType;
     _constructor = constructor;
     _components = new Stack<Component>(capacity);
 }
Пример #2
0
 internal Component GetComponent(Entity entity, ComponentType type)
 {
     Bag<Component> components;
     if (_globalStorage.TryGetValue(entity.Id, out components))
     {
         Component component;
         if (components.TryGetValue(type.Id, out component))
             return component;
     }
     return null;
 }