C# Class TrashMan, RecyclerKit

Inheritance: MonoBehaviour
Afficher le fichier Open project: prime31/RecyclerKit Class Usage Examples

Méthodes publiques

Свойство Type Description
cullExcessObjectsInterval float
instance TrashMan,
persistBetweenScenes bool

Méthodes publiques

Méthode Description
despawn ( GameObject go ) : void

sticks the GameObject back into its recycle bin. If the GameObject has no bin it is destroyed.

despawnAfterDelay ( GameObject go, float delayInSeconds ) : void

sticks the GameObject back into it's recycle bin after a delay. If the GameObject has no bin it is destroyed.

manageRecycleBin ( TrashManRecycleBin, recycleBin ) : void

tells TrashMan to start managing the recycle bin at runtime

recycleBinForGameObject ( GameObject go ) : TrashManRecycleBin,

gets the recycle bin for the given GameObject. Returns null if none exists.

recycleBinForGameObjectName ( string gameObjectName ) : TrashManRecycleBin,

gets the recycle bin for the given GameObject name. Returns null if none exists.

removeRecycleBin ( TrashManRecycleBin, recycleBin, bool shouldDestroyAllManagedObjects = true ) : void

stops managing the recycle bin optionally destroying all managed objects

spawn ( GameObject go, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion) ) : GameObject

pulls an object out of the recycle bin

spawn ( string gameObjectName, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion) ) : GameObject

pulls an object out of the recycle bin using the bin's name

Private Methods

Méthode Description
Awake ( ) : void
OnApplicationQuit ( ) : void
activeSceneChanged ( Scene, oldScene, Scene, newScene ) : void
cullExcessObjects ( ) : IEnumerator

coroutine that runs every couple seconds and removes any objects created over the recycle bins limit

initializePrefabPools ( ) : void

populats the lookup dictionaries

internalDespawnAfterDelay ( GameObject go, float delayInSeconds ) : IEnumerator

internal coroutine for despawning after a delay

spawn ( int gameObjectInstanceId, Vector3 position, Quaternion rotation ) : GameObject

internal method that actually does the work of grabbing the item from the bin and returning it

Method Details

despawn() public static méthode

sticks the GameObject back into its recycle bin. If the GameObject has no bin it is destroyed.
public static despawn ( GameObject go ) : void
go GameObject Go.
Résultat void

despawnAfterDelay() public static méthode

sticks the GameObject back into it's recycle bin after a delay. If the GameObject has no bin it is destroyed.
public static despawnAfterDelay ( GameObject go, float delayInSeconds ) : void
go GameObject Go.
delayInSeconds float
Résultat void

manageRecycleBin() public static méthode

tells TrashMan to start managing the recycle bin at runtime
public static manageRecycleBin ( TrashManRecycleBin, recycleBin ) : void
recycleBin TrashManRecycleBin, Recycle bin.
Résultat void

recycleBinForGameObject() public static méthode

gets the recycle bin for the given GameObject. Returns null if none exists.
public static recycleBinForGameObject ( GameObject go ) : TrashManRecycleBin,
go GameObject Go.
Résultat TrashManRecycleBin,

recycleBinForGameObjectName() public static méthode

gets the recycle bin for the given GameObject name. Returns null if none exists.
public static recycleBinForGameObjectName ( string gameObjectName ) : TrashManRecycleBin,
gameObjectName string
Résultat TrashManRecycleBin,

removeRecycleBin() public static méthode

stops managing the recycle bin optionally destroying all managed objects
public static removeRecycleBin ( TrashManRecycleBin, recycleBin, bool shouldDestroyAllManagedObjects = true ) : void
recycleBin TrashManRecycleBin, Recycle bin.
shouldDestroyAllManagedObjects bool If set to true should destroy all managed objects.
Résultat void

spawn() public static méthode

pulls an object out of the recycle bin
public static spawn ( GameObject go, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion) ) : GameObject
go GameObject Go.
position Vector3
rotation Quaternion
Résultat GameObject

spawn() public static méthode

pulls an object out of the recycle bin using the bin's name
public static spawn ( string gameObjectName, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion) ) : GameObject
gameObjectName string
position Vector3
rotation Quaternion
Résultat GameObject

Property Details

cullExcessObjectsInterval public_oe property

this is how often in seconds TrashMan should cull excess objects. Setting this to 0 or a negative number will fully turn off automatic culling. You can then use the TrashManRecycleBin.cullExcessObjects method manually if you would still like to do any culling.
public float cullExcessObjectsInterval
Résultat float

instance public_oe static_oe property

access to the singleton
public static TrashMan, instance
Résultat TrashMan,

persistBetweenScenes public_oe property

if true, DontDestroyOnLoad will be called on the TrashMan
public bool persistBetweenScenes
Résultat bool