OGWAspectCollection Class Reference
Inherits from | NSObject |
Declared in | OGWAspectCollection.h |
Overview
Container for an entity’s and the world’s aspects. Read the OGWAspect documentation for more info.
Warning: There can only be one aspect of a given class in the aspect collection. Any situation where an aspect may be needed more than once on the same entity is better implemented using either an aspect aggregating other objects or at its simplest level by using a counter. Said by analogy: don’t implement an arrow aspect, implement a quiver aspect instead!
Tasks
Accessing Aspects
-
all
property -
updateable
property -
– aspectWithClass:
Adding Aspects
Removing Aspects
Properties
Instance Methods
addAspect:
Adds an aspect.
- (void)addAspect:(OGWAspect *)aspect
Parameters
- aspect
The aspect to add.
See Also
Declared In
OGWAspectCollection.h
addAspectsInArray:
Adds aspect from an array.
- (void)addAspectsInArray:(NSArray *)aspects
Parameters
- aspects
An array of aspects to add.
Declared In
OGWAspectCollection.h
addAspectsWithClasses:entity:
Creates aspect from the Class objects in an array and adds them to the entity.
- (void)addAspectsWithClasses:(NSArray *)aspectClasses entity:(OGWEntity *)entity
Parameters
- aspectClasses
An array of aspect Class objects to create and add.
- entity
The entity the aspects will be added to.
See Also
Declared In
OGWAspectCollection.h
addAspectsWithClasses:world:
Creates aspect from the Class objects in an array and adds them to the world.
- (void)addAspectsWithClasses:(NSArray *)aspectClasses world:(OGWWorld *)world
Parameters
- aspectClasses
An array of aspect Class objects to create and add.
- world
The world the aspects will be added to.
See Also
Declared In
OGWAspectCollection.h
aspectWithClass:
Aspects are internally referenced by Class, so lookup for aspects by Class is fast.
- (id)aspectWithClass:(Class)aspectClass
Parameters
- aspectClass
The Class object of the aspect to return.
Return Value
The aspect of the given class, or nil if no such aspect of this class exists.
Discussion
Warning: Class equality is used, this is the equivalent of isMemberOfClass and not isKindOfClass. For example looking for [OGWAspect class] will not return any aspect because the class must be an exact match.
See Also
Declared In
OGWAspectCollection.h
removeAspect:
Removes an aspect.
- (void)removeAspect:(OGWAspect *)aspect
Parameters
- aspect
The aspect to remove.
Declared In
OGWAspectCollection.h