コード例 #1
0
        public StaticMemoryPoolBaseBase(Action <TValue> onDespawnedMethod)
        {
            _onDespawnedMethod = onDespawnedMethod;

#if UNITY_EDITOR
            StaticMemoryPoolRegistry.Add(this);
#endif
        }
コード例 #2
0
ファイル: MemoryPoolBase.cs プロジェクト: tertle/ecs-so
        void Construct(
            IFactory <TContract> factory,
            DiContainer container,
            [InjectOptional]
            MemoryPoolSettings settings)
        {
            _settings  = settings ?? MemoryPoolSettings.Default;
            _factory   = factory;
            _container = container;

            _inactiveItems = new Stack <TContract>(_settings.InitialSize);

            if (!container.IsValidating)
            {
                for (int i = 0; i < _settings.InitialSize; i++)
                {
                    _inactiveItems.Push(AllocNew());
                }
            }

            StaticMemoryPoolRegistry.Add(this);
        }
コード例 #3
0
 public StaticMemoryPoolBase(Action <TValue> onDespawnedMethod)
 {
     _onDespawnedMethod = onDespawnedMethod;
     StaticMemoryPoolRegistry.Add(this);
 }