コード例 #1
0
        static void OnDespawned(DisposeBlock that)
        {
            if (that._disposables != null)
            {
                // Dispose in reverse order since usually that makes the most sense
                for (int i = that._disposables.Count - 1; i >= 0; i--)
                {
                    that._disposables[i].Dispose();
                }
                ListPool <IDisposable> .Instance.Despawn(that._disposables);

                that._disposables = null;
            }

            if (that._objectPoolPairs != null)
            {
                // Dispose in reverse order since usually that makes the most sense
                for (int i = that._objectPoolPairs.Count - 1; i >= 0; i--)
                {
                    var pair = that._objectPoolPairs[i];
                    pair.Pool.Despawn(pair.Object);
                }
                ListPool <SpawnedObjectPoolPair> .Instance.Despawn(that._objectPoolPairs);

                that._objectPoolPairs = null;
            }
        }
コード例 #2
0
 static void OnSpawned(DisposeBlock that)
 {
     Assert.IsNull(that._disposables);
     Assert.IsNull(that._objectPoolPairs);
 }