3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A cache for transient shape objects. More...
Public Member Functions | |
TransientShapeCache () | |
Create a new cache starting with the default number of objects. | |
TransientShapeCache (int initialCapacity) | |
Create a new cache starting with the given initial number of objects. | |
void | Add (GameObject obj) |
Add a transient object to the cache. | |
GameObject | Fetch () |
Fetch and reuse an existing transient object from the cache. | |
void | Reset () |
Deactivate all objects. | |
void | Reset (bool deleteObjects) |
Reset the cache to have no active objects, optinally deleting the objects. | |
Public Attributes | |
const int | DefaultCacheSize = 512 |
Default number of objects to start with. | |
Properties | |
int | Count [get] |
The number of cached objects. | |
GameObject | LastObject [get] |
Access the activated transient object. | |
IEnumerable< GameObject > | Objects [get] |
Iterate the active objects (active only). |
A cache for transient shape objects.
The intended usage is to create shape objects as required, then register them with the cache. The cache ensures they are remove from the scene when Reset() is called. However, the objects are not destroyed and may be re-used by requesting an existing object calling Fetch(). This fails if no cached objects are available, in which case a new object should be registered using Add(GameObject).
Tes::Handlers::TransientShapeCache::TransientShapeCache | ( | int | initialCapacity | ) | [inline] |
Create a new cache starting with the given initial number of objects.
initialCapacity | The initial number of objects. |
void Tes::Handlers::TransientShapeCache::Add | ( | GameObject | obj | ) | [inline] |
Add a transient object to the cache.
obj | The new transient object. |
GameObject Tes::Handlers::TransientShapeCache::Fetch | ( | ) | [inline] |
Fetch and reuse an existing transient object from the cache.
void Tes::Handlers::TransientShapeCache::Reset | ( | bool | deleteObjects | ) | [inline] |
Reset the cache to have no active objects, optinally deleting the objects.
deleteObjects | True to delete the objects. |
int Tes::Handlers::TransientShapeCache::Count [get] |
The number of cached objects.
Fewer objects may be active.
GameObject Tes::Handlers::TransientShapeCache::LastObject [get] |
Access the activated transient object.