C# Класс TrashMan, RecyclerKit

Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
cullExcessObjectsInterval float
instance TrashMan,
persistBetweenScenes bool

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

despawn() публичный статический Метод

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.
Результат void

despawnAfterDelay() публичный статический Метод

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
Результат void

manageRecycleBin() публичный статический Метод

tells TrashMan to start managing the recycle bin at runtime
public static manageRecycleBin ( TrashManRecycleBin, recycleBin ) : void
recycleBin TrashManRecycleBin, Recycle bin.
Результат void

recycleBinForGameObject() публичный статический Метод

gets the recycle bin for the given GameObject. Returns null if none exists.
public static recycleBinForGameObject ( GameObject go ) : TrashManRecycleBin,
go GameObject Go.
Результат TrashManRecycleBin,

recycleBinForGameObjectName() публичный статический Метод

gets the recycle bin for the given GameObject name. Returns null if none exists.
public static recycleBinForGameObjectName ( string gameObjectName ) : TrashManRecycleBin,
gameObjectName string
Результат TrashManRecycleBin,

removeRecycleBin() публичный статический Метод

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.
Результат void

spawn() публичный статический Метод

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
Результат GameObject

spawn() публичный статический Метод

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
Результат GameObject

Описание свойств

cullExcessObjectsInterval публичное свойство

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
Результат float

instance публичное статическое свойство

access to the singleton
public static TrashMan, instance
Результат TrashMan,

persistBetweenScenes публичное свойство

if true, DontDestroyOnLoad will be called on the TrashMan
public bool persistBetweenScenes
Результат bool