Highroad Engine v1.3
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MoreMountains.Tools.MMObjectPooler Class Reference

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. More...

Inheritance diagram for MoreMountains.Tools.MMObjectPooler:
MoreMountains.Tools.MMMultipleObjectPooler 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 More...
 
virtual void FillObjectPool ()
 Implement this method to fill the pool with objects More...
 
virtual GameObject GetPooledGameObject ()
 Implement this method to return a gameobject More...
 
virtual void DestroyObjectPool ()
 Destroys the object pool More...
 

Static Public Member Functions

static void AddPool (MMObjectPool pool)
 Adds a pooler to the static list if needed More...
 
static void RemovePool (MMObjectPool pool)
 Removes a pooler from the static list More...
 

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. More...
 
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 More...
 
bool NestUnderThis = false
 if this is true, the waiting pool will be nested under this object More...
 

Static Public Attributes

static MMObjectPooler Instance
 singleton pattern More...
 
static List< MMObjectPool_pools = new List<MMObjectPool>(_initialPoolsListCapacity)
 

Protected Member Functions

virtual void Awake ()
 On awake we fill our object pool More...
 
virtual bool CreateWaitingPool ()
 Creates the waiting pool or tries to reuse one if there's already one available More...
 
virtual void ApplyNesting ()
 If needed, nests the waiting pool under this object More...
 
virtual string DetermineObjectPoolName ()
 Determines the name of the object pool. More...
 

Protected Attributes

GameObject _waitingPool = null
 this object is just used to group the pooled objects More...
 
MMObjectPool _objectPool
 

Static Protected Attributes

const int _initialPoolsListCapacity = 5
 

Detailed Description

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.

Member Function Documentation

◆ AddPool()

static void MoreMountains.Tools.MMObjectPooler.AddPool ( MMObjectPool  pool)
static

Adds a pooler to the static list if needed

Parameters
pool

◆ ApplyNesting()

virtual void MoreMountains.Tools.MMObjectPooler.ApplyNesting ( )
protectedvirtual

If needed, nests the waiting pool under this object

◆ Awake()

virtual void MoreMountains.Tools.MMObjectPooler.Awake ( )
protectedvirtual

On awake we fill our object pool

◆ CreateWaitingPool()

virtual bool MoreMountains.Tools.MMObjectPooler.CreateWaitingPool ( )
protectedvirtual

Creates the waiting pool or tries to reuse one if there's already one available

◆ DestroyObjectPool()

virtual void MoreMountains.Tools.MMObjectPooler.DestroyObjectPool ( )
virtual

Destroys the object pool

◆ DetermineObjectPoolName()

virtual string MoreMountains.Tools.MMObjectPooler.DetermineObjectPoolName ( )
protectedvirtual

Determines the name of the object pool.

Returns
The object pool name.

Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.

◆ ExistingPool()

virtual MMObjectPool MoreMountains.Tools.MMObjectPooler.ExistingPool ( string  poolName)
virtual

Looks for an existing pooler for the same object, returns it if found, returns null otherwise

Parameters
objectToPool
Returns

◆ FillObjectPool()

virtual void MoreMountains.Tools.MMObjectPooler.FillObjectPool ( )
virtual

Implement this method to fill the pool with objects

Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.

◆ GetPooledGameObject()

virtual GameObject MoreMountains.Tools.MMObjectPooler.GetPooledGameObject ( )
virtual

Implement this method to return a gameobject

Returns
The pooled game object.

Reimplemented in MoreMountains.Tools.MMMultipleObjectPooler, and MoreMountains.Tools.MMSimpleObjectPooler.

◆ RemovePool()

static void MoreMountains.Tools.MMObjectPooler.RemovePool ( MMObjectPool  pool)
static

Removes a pooler from the static list

Parameters
pool

Member Data Documentation

◆ _initialPoolsListCapacity

const int MoreMountains.Tools.MMObjectPooler._initialPoolsListCapacity = 5
staticprotected

◆ _objectPool

MMObjectPool MoreMountains.Tools.MMObjectPooler._objectPool
protected

◆ _pools

List<MMObjectPool> MoreMountains.Tools.MMObjectPooler._pools = new List<MMObjectPool>(_initialPoolsListCapacity)
static

◆ _waitingPool

GameObject MoreMountains.Tools.MMObjectPooler._waitingPool = null
protected

this object is just used to group the pooled objects

◆ Instance

MMObjectPooler MoreMountains.Tools.MMObjectPooler.Instance
static

singleton pattern

◆ MutualizeWaitingPools

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.

◆ NestUnderThis

bool MoreMountains.Tools.MMObjectPooler.NestUnderThis = false

if this is true, the waiting pool will be nested under this object

◆ NestWaitingPool

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


The documentation for this class was generated from the following file: