C# Class MBAnchor, Pharos

Class to create visible hierarchies and emitter pooling within Magical Box
Though any GameObject can be used to group emitters (as long as it's inside a ParticleSystem's child hierarchy), Anchors are shown in the editor window and draw their own gizmo icon. They also include pooling manager capabilities for easy emitter pooling
Inheritance: MBObject
Show file Open project: rstaewen/Pharos Class Usage Examples

Public Properties

Property Type Description
AllocationBlockSize int
AutoCull bool
AutoDespawn bool
CullingSpeed float
MaxPoolSize int
MinPoolSize int
OnMaxPoolSize MBAnchorPoolExceededMode
PoolingEnabled bool

Public Methods

Method Description
ClearPool ( ) : void

Remove all instances held by the pool

Cull ( ) : void

Shrink the stock to match MaxPoolSize

Cull ( bool smartCull ) : void

Shrink the stock to match MaxPoolSize

Despawn ( MBEmitter item ) : void

Despawn an item and add it back to the stock

DespawnAll ( ) : void

Despawn all items currently spawned from this pool

IsManaged ( MBEmitter item ) : bool

Whether an item is managed by this pool

IsSpawned ( MBEmitter item ) : bool

Whether an item is spawned by this pool

LateUpdate ( ) : void
Populate ( int no ) : void

Create instances and add them to the stock

PreparePool ( ) : void

Clear all instances and repopulate the pool to match MinPoolSize

Spawn ( ) : MBEmitter

Spawn an instance, make it active and add it to the Spawned list

callbackAutoDespawn ( MBEvent, e ) : void

Private Methods

Method Description
AddEmitter ( ) : MBEmitter
AddEmitter ( MBEmitter source ) : MBEmitter
Start ( ) : IEnumerator

Method Details

ClearPool() public method

Remove all instances held by the pool
public ClearPool ( ) : void
return void

Cull() public method

Shrink the stock to match MaxPoolSize
public Cull ( ) : void
return void

Cull() public method

Shrink the stock to match MaxPoolSize
public Cull ( bool smartCull ) : void
smartCull bool if true a maximum of AllocationBlockSize items are culled
return void

Despawn() public method

Despawn an item and add it back to the stock
public Despawn ( MBEmitter item ) : void
item MBEmitter
return void

DespawnAll() public method

Despawn all items currently spawned from this pool
public DespawnAll ( ) : void
return void

IsManaged() public method

Whether an item is managed by this pool
public IsManaged ( MBEmitter item ) : bool
item MBEmitter an item
return bool

IsSpawned() public method

Whether an item is spawned by this pool
public IsSpawned ( MBEmitter item ) : bool
item MBEmitter an item
return bool

LateUpdate() public method

public LateUpdate ( ) : void
return void

Populate() public method

Create instances and add them to the stock
public Populate ( int no ) : void
no int
return void

PreparePool() public method

Clear all instances and repopulate the pool to match MinPoolSize
public PreparePool ( ) : void
return void

Spawn() public method

Spawn an instance, make it active and add it to the Spawned list
public Spawn ( ) : MBEmitter
return MBEmitter

callbackAutoDespawn() public method

public callbackAutoDespawn ( MBEvent, e ) : void
e MBEvent,
return void

Property Details

AllocationBlockSize public property

The number of items processed at once when the pool need to grow or shrink
public int AllocationBlockSize
return int

AutoCull public property

Whether the pool should automatically cull items that exceeds MaxPoolSize
public bool AutoCull
return bool

AutoDespawn public property

Whether spawned emitters will despawn automatically once they stop playing
public bool AutoDespawn
return bool

CullingSpeed public property

Time in seconds between culling actions
public float CullingSpeed
return float

MaxPoolSize public property

Maximum number of items int the pool
public int MaxPoolSize
return int

MinPoolSize public property

Minimum number of items in the pool
public int MinPoolSize
return int

OnMaxPoolSize public property

Determines the behaviour when the pool exceeds MaxPoolSize
public MBAnchorPoolExceededMode OnMaxPoolSize
return MBAnchorPoolExceededMode

PoolingEnabled public property

Whether this anchor acts as a pooling manager
public bool PoolingEnabled
return bool