Fixed object pool unlimited mode.
This commit is contained in:
parent
326d97bd64
commit
72925842b7
@ -24,7 +24,7 @@ namespace SlatedGameToolkit.Framework.Utilities.Collections.Pooling
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void CreateAmount(int amount) {
|
public void CreateAmount(int amount) {
|
||||||
if (Size >= 0 && Count + amount >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size));
|
if (Size > 0 && Count + amount >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size));
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
pool.Add(creator());
|
pool.Add(creator());
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ namespace SlatedGameToolkit.Framework.Utilities.Collections.Pooling
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Release(Poolable poolable) {
|
public void Release(Poolable poolable) {
|
||||||
if (Size >= 0 && Count + 1 >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size));
|
if (Size > 0 && Count + 1 >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size));
|
||||||
poolable.Reset();
|
poolable.Reset();
|
||||||
pool.Add(poolable);
|
pool.Add(poolable);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user