public DelayedUpdate(Op type, int entity, IComponentPool component, int componentId) { Type = type; Entity = entity; Pool = component; ComponentId = componentId; }
/// <summary>Sets the pool for a specific type</summary> /// <param name="type">The type.</param> /// <param name="pool">The pool.</param> public void SetPool(Type type, IComponentPool <ComponentPoolable> pool) { Debug.Assert(type != null, "Type must not be null."); Debug.Assert(pool != null, "Component pool must not be null."); this.pools.Add(type, pool); }
protected void AddComponentPool(IComponentPool pool) { if (_pools.Length == _poolsCount) { Array.Resize(ref _pools, _poolsCount << 1); } _pools[_poolsCount++] = pool; }
protected void AddDelayedUpdate(DelayedUpdate.Op type, int entity, IComponentPool component, int componentId) { if (_delayedUpdatesCount == _delayedUpdates.Length) { Array.Resize(ref _delayedUpdates, _delayedUpdatesCount << 1); } _delayedUpdates[_delayedUpdatesCount++] = new DelayedUpdate(type, entity, component, componentId); }
/// <summary>Entities the manager removed component event.</summary> /// <param name="entity">The entity.</param> /// <param name="component">The component.</param> private void EntityManagerRemovedComponentEvent(Entity entity, IComponent component) { ComponentPoolable componentPoolable = component as ComponentPoolable; if (componentPoolable != null) { if (componentPoolable.PoolId < 0) { return; } IComponentPool <ComponentPoolable> pool = this.entityWorld.GetPool(component.GetType()); if (pool != null) { pool.ReturnObject(componentPoolable); } } }
public PoolDecorator(IComponentPool <T> componentPool, EntityManager entityManager, ISystem system) { this.wrappedPool = componentPool; this.entityManager = entityManager; this.system = system; }
void IComponentPoolElement.OnRepool(IComponentPool pool) { OnRepool(pool as T); }
public ReadOnlyStorage(IComponentPool <T> pool) => _pool = pool;
public static void Initialize(IComponentPool pool) { Instance = pool; }
public static void Initialize(IComponentIndex index) { Instance = new ComponentPool(index); }
public MutableStorage(IComponentPool <T> pool) => _pool = pool;