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!

Properties

all

The array is not dynamically created, hence access is fast.

@property (readonly) NSArray *all

Return Value

An array of all aspects, in the order they were added.

Declared In

OGWAspectCollection.h

updateable

@property (readonly) NSArray *updateable

Instance Methods

addAspect:

Adds an aspect.

- (void)addAspect:(OGWAspect *)aspect

Parameters

aspect

The aspect to add.

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.

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.

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.

Declared In

OGWAspectCollection.h

removeAllAspects

Removes all aspects.

- (void)removeAllAspects

Declared In

OGWAspectCollection.h

removeAspect:

Removes an aspect.

- (void)removeAspect:(OGWAspect *)aspect

Parameters

aspect

The aspect to remove.

Declared In

OGWAspectCollection.h

removeAspectWithClass:

Removes an aspect by its Class.

- (void)removeAspectWithClass:(Class)aspectClass

Parameters

aspectClass

The Class object of an aspect to remove.

Declared In

OGWAspectCollection.h