![]() |
Inventory Engine v4.2
|
A base class, meant to be extended depending on the use (simple, multiple object pooler), and used as an interface by the spawners. More...
Inherits MonoBehaviour.
Inherited by MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.
Public Member Functions | |
virtual MMObjectPool | ExistingPool (string poolName) |
Looks for an existing pooler for the same object, returns it if found, returns null otherwise. | |
virtual void | FillObjectPool () |
Implement this method to fill the pool with objects. | |
virtual GameObject | GetPooledGameObject () |
Implement this method to return a gameobject. | |
virtual void | DestroyObjectPool () |
Destroys the object pool. |
Static Public Member Functions | |
static void | AddPool (MMObjectPool pool) |
Adds a pooler to the static list if needed. | |
static void | RemovePool (MMObjectPool pool) |
Removes a pooler from the static list. |
Public Attributes | |
bool | MutualizeWaitingPools = false |
if this is true, the pool will try not to create a new waiting pool if it finds one with the same name. | |
bool | NestWaitingPool = true |
if this is true, all waiting and active objects will be regrouped under an empty game object. Otherwise they'll just be at top level in the hierarchy | |
bool | NestUnderThis = false |
if this is true, the waiting pool will be nested under this object |
Static Public Attributes | |
static MMObjectPooler | Instance |
singleton pattern | |
static List< MMObjectPool > | _pools = new List<MMObjectPool>(_initialPoolsListCapacity) |
Protected Member Functions | |
virtual void | Awake () |
On awake we fill our object pool. | |
virtual bool | CreateWaitingPool () |
Creates the waiting pool or tries to reuse one if there's already one available. | |
virtual void | ApplyNesting () |
If needed, nests the waiting pool under this object. | |
virtual string | DetermineObjectPoolName () |
Determines the name of the object pool. | |
virtual void | OnEnable () |
On enable we register to the scene loaded hook. |
Static Protected Member Functions | |
static void | InitializeStatics () |
Protected Attributes | |
GameObject | _waitingPool = null |
this object is just used to group the pooled objects | |
MMObjectPool | _objectPool |
bool | _onSceneLoadedRegistered = false |
Static Protected Attributes | |
const int | _initialPoolsListCapacity = 5 |
A base class, meant to be extended depending on the use (simple, multiple object pooler), and used as an interface by the spawners.
Still handles common stuff like singleton and initialization on start(). DO NOT add this class to a prefab, nothing would happen. Instead, add SimpleObjectPooler or MultipleObjectPooler.
|
static |
Adds a pooler to the static list if needed.
pool |
|
protectedvirtual |
If needed, nests the waiting pool under this object.
|
protectedvirtual |
On awake we fill our object pool.
|
protectedvirtual |
Creates the waiting pool or tries to reuse one if there's already one available.
|
virtual |
Destroys the object pool.
|
protectedvirtual |
Determines the name of the object pool.
Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.
|
virtual |
Looks for an existing pooler for the same object, returns it if found, returns null otherwise.
objectToPool |
|
virtual |
Implement this method to fill the pool with objects.
Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.
|
virtual |
Implement this method to return a gameobject.
Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.
|
staticprotected |
|
protectedvirtual |
On enable we register to the scene loaded hook.
|
static |
Removes a pooler from the static list.
pool |
|
staticprotected |
|
protected |
|
protected |
|
static |
|
protected |
this object is just used to group the pooled objects
|
static |
singleton pattern
bool MoreMountains.Tools.MMObjectPooler.MutualizeWaitingPools = false |
if this is true, the pool will try not to create a new waiting pool if it finds one with the same name.
bool MoreMountains.Tools.MMObjectPooler.NestUnderThis = false |
if this is true, the waiting pool will be nested under this object
bool MoreMountains.Tools.MMObjectPooler.NestWaitingPool = true |
if this is true, all waiting and active objects will be regrouped under an empty game object. Otherwise they'll just be at top level in the hierarchy