Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.Pool Class Reference

A simple pool of objects. More...

Inheritance diagram for PlatformerPro.Pool:
PlatformerPro.Spawner PlatformerPro.EnemySpawner

Public Member Functions

void Start ()
 Unity Start hook. More...
 
virtual GameObject GetInstance ()
 Gets an instance form the pool, or null if no instances available. More...
 

Public Attributes

List< GameObject > pooledObjects
 The pooled objects. You can assign the pool here, this can be useful if you don't want all objects to be the same. More...
 
GameObject poolPrefab
 Prefab to use to create new pool objects. More...
 
int startingSize
 Starting size of pool. More...
 
bool createMoreIfExhausted
 Should we create more objects if pool is exhausted or should we throw an error. More...
 

Protected Member Functions

virtual void Init ()
 Initialise pool. More...
 
virtual void PopulatePool ()
 Initialise the pool. More...
 
virtual GameObject CreateInstance ()
 Creates a new instance. More...
 
virtual void Reset (GameObject instance)
 Reset the specified instance. Specific implementations should override this. More...
 

Protected Attributes

int currentPosition
 Current position in pool. More...
 

Detailed Description

A simple pool of objects.

Member Function Documentation

◆ CreateInstance()

virtual GameObject PlatformerPro.Pool.CreateInstance ( )
protectedvirtual

Creates a new instance.

Returns
The instance.

◆ GetInstance()

virtual GameObject PlatformerPro.Pool.GetInstance ( )
virtual

Gets an instance form the pool, or null if no instances available.

Returns
The instance or null.

◆ Init()

virtual void PlatformerPro.Pool.Init ( )
protectedvirtual

Initialise pool.

Reimplemented in PlatformerPro.Spawner, and PlatformerPro.EnemySpawner.

◆ PopulatePool()

virtual void PlatformerPro.Pool.PopulatePool ( )
protectedvirtual

Initialise the pool.

◆ Reset()

virtual void PlatformerPro.Pool.Reset ( GameObject  instance)
protectedvirtual

Reset the specified instance. Specific implementations should override this.

Parameters
instanceInstance.

Reimplemented in PlatformerPro.EnemySpawner.

◆ Start()

void PlatformerPro.Pool.Start ( )

Unity Start hook.

Member Data Documentation

◆ createMoreIfExhausted

bool PlatformerPro.Pool.createMoreIfExhausted

Should we create more objects if pool is exhausted or should we throw an error.

◆ currentPosition

int PlatformerPro.Pool.currentPosition
protected

Current position in pool.

◆ pooledObjects

List<GameObject> PlatformerPro.Pool.pooledObjects

The pooled objects. You can assign the pool here, this can be useful if you don't want all objects to be the same.

◆ poolPrefab

GameObject PlatformerPro.Pool.poolPrefab

Prefab to use to create new pool objects.

◆ startingSize

int PlatformerPro.Pool.startingSize

Starting size of pool.


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