C# Class TrashManRecycleBin, RecyclerKit

ファイルを表示 Open project: prime31/RecyclerKit Class Usage Examples

Public Properties

Property Type Description
automaticallyRecycleParticleSystems bool
cullExcessPrefabs bool
cullInterval float
hardLimit int
imposeHardLimit bool
instancesToAllocateIfEmpty int
instancesToMaintainInPool int
instancesToPreallocate int
persistBetweenScenes bool
prefab GameObject

Public Methods

Method Description
allocateGameObjects ( int count ) : void

allocates

clearBin ( bool shouldDestroyAllManagedObjects ) : void

clears out the bin optionally calling Destroy on all objects in it. note than any spawned objects are not touched by this operation!

cullExcessObjects ( ) : void

culls any excess objects if necessary

despawn ( GameObject go ) : void

returns an instance to the recycle bin

initialize ( ) : void

preps the Stack and does preallocation

spawn ( ) : GameObject

fetches a new instance from the recycle bin. Returns null if we reached the hardLimit.

Private Methods

Method Description
pop ( ) : GameObject

pops an object off the stack. Returns null if we hit the hardLimit.

Method Details

allocateGameObjects() public method

allocates
public allocateGameObjects ( int count ) : void
count int Count.
return void

clearBin() public method

clears out the bin optionally calling Destroy on all objects in it. note than any spawned objects are not touched by this operation!
public clearBin ( bool shouldDestroyAllManagedObjects ) : void
shouldDestroyAllManagedObjects bool
return void

cullExcessObjects() public method

culls any excess objects if necessary
public cullExcessObjects ( ) : void
return void

despawn() public method

returns an instance to the recycle bin
public despawn ( GameObject go ) : void
go GameObject Go.
return void

initialize() public method

preps the Stack and does preallocation
public initialize ( ) : void
return void

spawn() public method

fetches a new instance from the recycle bin. Returns null if we reached the hardLimit.
public spawn ( ) : GameObject
return GameObject

Property Details

automaticallyRecycleParticleSystems public_oe property

if true, the GameObject must contain a ParticleSystem! It will be automatically despawned after system.duration.
public bool automaticallyRecycleParticleSystems
return bool

cullExcessPrefabs public_oe property

if true, any excess instances will be culled at regular intervals
public bool cullExcessPrefabs
return bool

cullInterval public_oe property

how often in seconds should culling occur
public float cullInterval
return float

hardLimit public_oe property

if imposeHardLimit is true, this will be the maximum number of instances to create
public int hardLimit
return int

imposeHardLimit public_oe property

if true, the recycle bin will not create any more instances when hardLimit is reached and will instead return null for any spanws
public bool imposeHardLimit
return bool

instancesToAllocateIfEmpty public_oe property

total number of instances to allocate if one is requested when the bin is empty
public int instancesToAllocateIfEmpty
return int

instancesToMaintainInPool public_oe property

total instances to keep in the pool. All excess will be culled if cullExcessPrefabs is true
public int instancesToMaintainInPool
return int

instancesToPreallocate public_oe property

total number of instances to create at start
public int instancesToPreallocate
return int

persistBetweenScenes public_oe property

if true and TrashMan.persistBetweenScenes is true this recycle bin will not be purged when a new level loads
public bool persistBetweenScenes
return bool

prefab public_oe property

The prefab or GameObject in the scene managed by this class.
public GameObject prefab
return GameObject