Feel
4.3
The best way to improve your game's feel and make it extra juicy
|
This class allows you to have a pool of various objects to pool from. More...
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 GameObject | GetPooledGamObjectAtIndex (int index) |
Gets an object of the type at the specified index in the Pool. Note that the whole point of this multiple object pooler is to abstract the various pools and handle the picking based on the selected mode. If you plan on just picking from different pools yourself, consider simply having multiple single object poolers. More... | |
virtual GameObject | GetPooledGameObjectOfType (string searchedName) |
Gets an object of the specified name from the pool Note that the whole point of this multiple object pooler is to abstract the various pools and handle the picking based on the selected mode. If you plan on just picking from different pools yourself, consider simply having multiple single object poolers. 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< MMMultipleObjectPoolerObject > | Pool |
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... | |
float | OverflowAmount = 10f |
if CanPoolSameObjectTwice is set to false, this determines up to how many times we'll iterate to try and find a different object 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 void | OrderSequentialResetCounter (MMMultipleObjectPoolerObject searchedObject) |
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 | 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... | |
virtual void | OnEnable () |
On enable we register to the scene loaded hook More... | |
Protected Attributes | |
GameObject | _lastPooledObject |
the actual object pool More... | |
int | _currentIndex = 0 |
int | _currentIndexCounter = 0 |
int | _currentCount = 0 |
string | _tempSearchedName |
Protected Attributes inherited from MoreMountains.Tools.MMObjectPooler | |
GameObject | _waitingPool = null |
this object is just used to group the pooled objects More... | |
MMObjectPool | _objectPool |
bool | _onSceneLoadedRegistered = false |
Properties | |
virtual List< MMMultipleObjectPooler > | Owner [get, set] |
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 Member Functions inherited from MoreMountains.Tools.MMObjectPooler | |
static void | InitializeStatics () |
Static Protected Attributes inherited from MoreMountains.Tools.MMObjectPooler | |
const int | _initialPoolsListCapacity = 5 |
This class allows you to have a pool of various objects to pool from.
|
protectedvirtual |
Adds one object of the specified type to the object pool.
typeOfObject | The type of object to add to the pool. |
|
protectedvirtual |
Determines the name of the object pool.
Reimplemented from MoreMountains.Tools.MMObjectPooler.
|
virtual |
|
virtual |
Fills the object pool with the amount of objects you specified in the inspector.
Reimplemented from MoreMountains.Tools.MMObjectPooler.
|
protectedvirtual |
|
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
searchedName | Searched name. |
|
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
searchedName | Searched name. |
|
virtual |
Gets a random object from the pool.
Reimplemented from MoreMountains.Tools.MMObjectPooler.
|
virtual |
Gets an object of the specified name from the pool Note that the whole point of this multiple object pooler is to abstract the various pools and handle the picking based on the selected mode. If you plan on just picking from different pools yourself, consider simply having multiple single object poolers.
type | Type. |
|
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)
|
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)
|
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)
|
protectedvirtual |
Gets one object from the pool, at random, but ignoring its pool size, each object has equal chances to get picked
|
virtual |
Gets an object of the type at the specified index in the Pool. Note that the whole point of this multiple object pooler is to abstract the various pools and handle the picking based on the selected mode. If you plan on just picking from different pools yourself, consider simply having multiple single object poolers.
index |
|
protectedvirtual |
Returns (if it exists) the MultipleObjectPoolerObject from the original Pool based on a GameObject. Note that this is name based.
testedObject | Tested object. |
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
|
protected |
|
protected |
|
protected |
|
protected |
the actual object pool
|
protected |
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.
string MoreMountains.Tools.MMMultipleObjectPooler.MutualizedPoolName = "" |
a unique name that should match on all MMMultipleObjectPoolers you want to use together
float MoreMountains.Tools.MMMultipleObjectPooler.OverflowAmount = 10f |
if CanPoolSameObjectTwice is set to false, this determines up to how many times we'll iterate to try and find a different object
List<MMMultipleObjectPoolerObject> MoreMountains.Tools.MMMultipleObjectPooler.Pool |
the list of objects to pool
MMPoolingMethods MoreMountains.Tools.MMMultipleObjectPooler.PoolingMethod = MMPoolingMethods.RandomPoolSizeBased |
the chosen pooling method
|
getset |