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

This class allows you to have a pool of various objects to pool from. More...

Inheritance diagram for MoreMountains.Tools.MMMultipleObjectPooler:
MoreMountains.Tools.MMObjectPooler

Public Member Functions

override void FillObjectPool ()
 Fills the object pool with the amount of objects you specified in the inspector. More...
 
override GameObject GetPooledGameObject ()
 Gets a random object from the pool. More...
 
virtual void EnableObjects (string name, bool newStatus)
 
virtual void ResetCurrentIndex ()
 
- Public Member Functions inherited from MoreMountains.Tools.MMObjectPooler
virtual MMObjectPool ExistingPool (string poolName)
 Looks for an existing pooler for the same object, returns it if found, returns null otherwise More...
 
virtual void DestroyObjectPool ()
 Destroys the object pool More...
 

Public Attributes

List< MMMultipleObjectPoolerObjectPool
 the list of objects to pool More...
 
MMPoolingMethods PoolingMethod = MMPoolingMethods.RandomPoolSizeBased
 the chosen pooling method More...
 
bool CanPoolSameObjectTwice =true
 whether or not the same object can be pooled twice in a row. If you set CanPoolSameObjectTwice to false, the Pooler will try to prevent the same object from being pooled twice to avoid repetition. This will only affect random pooling methods, not ordered pooling. More...
 
string MutualizedPoolName = ""
 a unique name that should match on all MMMultipleObjectPoolers you want to use together More...
 
- Public Attributes inherited from MoreMountains.Tools.MMObjectPooler
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...
 

Protected Member Functions

override string DetermineObjectPoolName ()
 Determines the name of the object pool. More...
 
virtual GameObject AddOneObjectToThePool (GameObject typeOfObject)
 Adds one object of the specified type to the object pool. More...
 
virtual GameObject GetPooledGameObjectOriginalOrder ()
 Tries to find a gameobject in the pool according to the order the list has been setup in (one of each, no matter how big their respective pool sizes) More...
 
virtual GameObject GetPooledGameObjectOriginalOrderSequential ()
 Tries to find a gameobject in the pool according to the order the list has been setup in (one of each, no matter how big their respective pool sizes) More...
 
virtual GameObject GetPooledGameObjectPoolSizeBased ()
 Randomly choses one object from the pool, based on its pool size probability (the larger the pool size, the higher the chances it'll get picked) More...
 
virtual GameObject GetPooledGameObjectRandomBetweenObjects ()
 Gets one object from the pool, at random, but ignoring its pool size, each object has equal chances to get picked More...
 
virtual GameObject GetPooledGameObjectOfType (string searchedName)
 Gets an object of the specified name from the pool More...
 
virtual GameObject FindInactiveObject (string searchedName, List< GameObject > list)
 Finds an inactive object in the pool based on its name. Returns null if no inactive object by that name were found in the pool More...
 
virtual GameObject FindAnyInactiveObject (List< GameObject > list)
 
virtual GameObject FindObject (string searchedName, List< GameObject > list)
 Finds an object in the pool based on its name, active or inactive Returns null if there's no object by that name in the pool More...
 
virtual MMMultipleObjectPoolerObject GetPoolObject (GameObject testedObject)
 Returns (if it exists) the MultipleObjectPoolerObject from the original Pool based on a GameObject. Note that this is name based. More...
 
virtual bool PoolObjectEnabled (GameObject testedObject)
 
- Protected Member Functions inherited from MoreMountains.Tools.MMObjectPooler
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...
 

Protected Attributes

GameObject _lastPooledObject
 the actual object pool More...
 
int _currentIndex = 0
 
int _currentIndexCounter = 0
 
- Protected Attributes inherited from MoreMountains.Tools.MMObjectPooler
GameObject _waitingPool = null
 this object is just used to group the pooled objects More...
 
MMObjectPool _objectPool
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMObjectPooler
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...
 
- Static Public Attributes inherited from MoreMountains.Tools.MMObjectPooler
static MMObjectPooler Instance
 singleton pattern More...
 
static List< MMObjectPool_pools = new List<MMObjectPool>(_initialPoolsListCapacity)
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMObjectPooler
const int _initialPoolsListCapacity = 5
 

Detailed Description

This class allows you to have a pool of various objects to pool from.

Member Function Documentation

◆ AddOneObjectToThePool()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.AddOneObjectToThePool ( GameObject  typeOfObject)
protectedvirtual

Adds one object of the specified type to the object pool.

Returns
The object that just got added.
Parameters
typeOfObjectThe type of object to add to the pool.

◆ DetermineObjectPoolName()

override string MoreMountains.Tools.MMMultipleObjectPooler.DetermineObjectPoolName ( )
protectedvirtual

Determines the name of the object pool.

Returns
The object pool name.

Reimplemented from MoreMountains.Tools.MMObjectPooler.

◆ EnableObjects()

virtual void MoreMountains.Tools.MMMultipleObjectPooler.EnableObjects ( string  name,
bool  newStatus 
)
virtual

◆ FillObjectPool()

override void MoreMountains.Tools.MMMultipleObjectPooler.FillObjectPool ( )
virtual

Fills the object pool with the amount of objects you specified in the inspector.

Reimplemented from MoreMountains.Tools.MMObjectPooler.

◆ FindAnyInactiveObject()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.FindAnyInactiveObject ( List< GameObject >  list)
protectedvirtual

◆ FindInactiveObject()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.FindInactiveObject ( string  searchedName,
List< GameObject >  list 
)
protectedvirtual

Finds an inactive object in the pool based on its name. Returns null if no inactive object by that name were found in the pool

Returns
The inactive object.
Parameters
searchedNameSearched name.

◆ FindObject()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.FindObject ( string  searchedName,
List< GameObject >  list 
)
protectedvirtual

Finds an object in the pool based on its name, active or inactive Returns null if there's no object by that name in the pool

Returns
The object.
Parameters
searchedNameSearched name.

◆ GetPooledGameObject()

override GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObject ( )
virtual

Gets a random object from the pool.

Returns
The pooled game object.

Reimplemented from MoreMountains.Tools.MMObjectPooler.

◆ GetPooledGameObjectOfType()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObjectOfType ( string  searchedName)
protectedvirtual

Gets an object of the specified name from the pool

Returns
The pooled game object of type.
Parameters
typeType.

◆ GetPooledGameObjectOriginalOrder()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObjectOriginalOrder ( )
protectedvirtual

Tries to find a gameobject in the pool according to the order the list has been setup in (one of each, no matter how big their respective pool sizes)

Returns
The pooled game object original order.

◆ GetPooledGameObjectOriginalOrderSequential()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObjectOriginalOrderSequential ( )
protectedvirtual

Tries to find a gameobject in the pool according to the order the list has been setup in (one of each, no matter how big their respective pool sizes)

Returns
The pooled game object original order.

◆ GetPooledGameObjectPoolSizeBased()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObjectPoolSizeBased ( )
protectedvirtual

Randomly choses one object from the pool, based on its pool size probability (the larger the pool size, the higher the chances it'll get picked)

Returns
The pooled game object pool size based.

◆ GetPooledGameObjectRandomBetweenObjects()

virtual GameObject MoreMountains.Tools.MMMultipleObjectPooler.GetPooledGameObjectRandomBetweenObjects ( )
protectedvirtual

Gets one object from the pool, at random, but ignoring its pool size, each object has equal chances to get picked

Returns
The pooled game object random between objects.

◆ GetPoolObject()

virtual MMMultipleObjectPoolerObject MoreMountains.Tools.MMMultipleObjectPooler.GetPoolObject ( GameObject  testedObject)
protectedvirtual

Returns (if it exists) the MultipleObjectPoolerObject from the original Pool based on a GameObject. Note that this is name based.

Returns
The pool object.
Parameters
testedObjectTested object.

◆ PoolObjectEnabled()

virtual bool MoreMountains.Tools.MMMultipleObjectPooler.PoolObjectEnabled ( GameObject  testedObject)
protectedvirtual

◆ ResetCurrentIndex()

virtual void MoreMountains.Tools.MMMultipleObjectPooler.ResetCurrentIndex ( )
virtual

Member Data Documentation

◆ _currentIndex

int MoreMountains.Tools.MMMultipleObjectPooler._currentIndex = 0
protected

◆ _currentIndexCounter

int MoreMountains.Tools.MMMultipleObjectPooler._currentIndexCounter = 0
protected

◆ _lastPooledObject

GameObject MoreMountains.Tools.MMMultipleObjectPooler._lastPooledObject
protected

the actual object pool

◆ CanPoolSameObjectTwice

bool MoreMountains.Tools.MMMultipleObjectPooler.CanPoolSameObjectTwice =true

whether or not the same object can be pooled twice in a row. If you set CanPoolSameObjectTwice to false, the Pooler will try to prevent the same object from being pooled twice to avoid repetition. This will only affect random pooling methods, not ordered pooling.

◆ MutualizedPoolName

string MoreMountains.Tools.MMMultipleObjectPooler.MutualizedPoolName = ""

a unique name that should match on all MMMultipleObjectPoolers you want to use together

◆ Pool

List<MMMultipleObjectPoolerObject> MoreMountains.Tools.MMMultipleObjectPooler.Pool

the list of objects to pool

◆ PoolingMethod

MMPoolingMethods MoreMountains.Tools.MMMultipleObjectPooler.PoolingMethod = MMPoolingMethods.RandomPoolSizeBased

the chosen pooling method


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