SpaceRTS - Starter Pack  1.3
NullPointerGame.Extras.ContentPool Class Reference

Helper class to maintain a constant buffer of GameObjects ready to use, and reuse. More...

Inheritance diagram for NullPointerGame.Extras.ContentPool:

Public Member Functions

GameObject Instantiate ()
 Takes an element from the buffer and returns it. if there is no more elements in the buffer an expansion will be produced. More...
 
void Destroy (GameObject itemToDestroy)
 Returns the GameObject to the buffer. More...
 
void Destroy (IEnumerable< GameObject > itemsToDestroy)
 Returns all the GameObjects to the Buffer More...
 

Public Attributes

GameObject template
 GameObject to use as a template for the buffer. More...
 
Transform alivesContainer
 Transform container for the instanced and alive GameObjects More...
 
Transform bufferContainer
 Transform container for the unused GameObjects More...
 
int minBuffer = 10
 Minimal amount of created GameObjects for the buffer More...
 
int expandBuffer = 4
 If the quantity of requested game object is reached, the buffer will expand by this quantity. More...
 
List< GameObject > buffer = new List<GameObject>()
 

Detailed Description

Helper class to maintain a constant buffer of GameObjects ready to use, and reuse.

Member Function Documentation

◆ Destroy() [1/2]

void NullPointerGame.Extras.ContentPool.Destroy ( GameObject  itemToDestroy)

Returns the GameObject to the buffer.

Parameters
itemToDestroyThe GameObject to be returned to the buffer.

◆ Destroy() [2/2]

void NullPointerGame.Extras.ContentPool.Destroy ( IEnumerable< GameObject >  itemsToDestroy)

Returns all the GameObjects to the Buffer

Parameters
itemsToDestroyThe list of GameObjects to return to the Buffer.

◆ Instantiate()

GameObject NullPointerGame.Extras.ContentPool.Instantiate ( )

Takes an element from the buffer and returns it. if there is no more elements in the buffer an expansion will be produced.

Returns
The usable GameObject returned by the buffer.

Member Data Documentation

◆ alivesContainer

Transform NullPointerGame.Extras.ContentPool.alivesContainer

Transform container for the instanced and alive GameObjects

◆ buffer

List<GameObject> NullPointerGame.Extras.ContentPool.buffer = new List<GameObject>()

◆ bufferContainer

Transform NullPointerGame.Extras.ContentPool.bufferContainer

Transform container for the unused GameObjects

◆ expandBuffer

int NullPointerGame.Extras.ContentPool.expandBuffer = 4

If the quantity of requested game object is reached, the buffer will expand by this quantity.

◆ minBuffer

int NullPointerGame.Extras.ContentPool.minBuffer = 10

Minimal amount of created GameObjects for the buffer

◆ template

GameObject NullPointerGame.Extras.ContentPool.template

GameObject to use as a template for the buffer.