Inherits from NSObject
Conforms to KKPhysicsContactEventDelegate
NSCoding
NSCopying
Declared in KKNodeController.h

Overview

KKNodeController adds game component (behavior, model) functionality to a node.

Properties

behaviors

The list of behaviors of the node.

@property (atomic, readonly) NSArray *behaviors

Return Value

The list of behaviors of the node.

Declared In

KKNodeController.h

model

The model object associated with this controller/node.

@property (atomic) KKModel *model

Return Value

The model object associated with this controller/node.

Declared In

KKNodeController.h

node

The controller’s owning node. You should never change this reference yourself!

@property (atomic, weak) SKNode *node

Return Value

The controller’s owning node. You should never change this reference yourself!

Declared In

KKNodeController.h

paused

If the controller is paused, the behaviors will stop receiving updates. Behaviors receiving events should also check the controller’s paused state to ensure they don’t process/forward events while paused.

@property (atomic) BOOL paused

Return Value

The current paused status.

Declared In

KKNodeController.h

userData

The controller’s userData supercedes the node’s userData and can be used in the same way. You should never change this reference yourself!

@property (atomic, strong) NSMutableDictionary *userData

Return Value

The controller’s userData supercedes the node’s userData and can be used in the same way. You should never change this reference yourself!

Declared In

KKNodeController.h

Class Methods

controllerWithBehaviors:

Creates a controller with a list of behaviors.

+ (id)controllerWithBehaviors:(NSArray *)behaviors

Parameters

behaviors

An array containing KKBehavior objects.

Return Value

A new instance.

Declared In

KKNodeController.h

Instance Methods

addBehavior:

Adds a behavior.

- (void)addBehavior:(KKBehavior *)behavior

Parameters

behavior

The behavior to add.

Declared In

KKNodeController.h

addBehavior:withKey:

Adds a behavior with key.

- (void)addBehavior:(KKBehavior *)behavior withKey:(NSString *)key

Parameters

behavior

The behavior to add.

key

The behavior’s uniquely identifying key.

Declared In

KKNodeController.h

addBehaviors:

Adds a list of behaviors.

- (void)addBehaviors:(NSArray *)behaviors

Parameters

behaviors

An array containing KKBehavior objects.

Declared In

KKNodeController.h

behaviorForKey:

A key uniquely identifying the behavior.

- (id)behaviorForKey:(NSString *)key

Parameters

key

A key uniquely identifying the behavior.

Return Value

The behavior for the key or nil if there is no behavior with that key.

Declared In

KKNodeController.h

behaviorKindOfClass:

The class uniquely identifying the behavior.

- (id)behaviorKindOfClass:(Class)behaviorClass

Parameters

behaviorClass

The class uniquely identifying the behavior.

Return Value

The first found behavior being a kind of class or nil if there is no behavior with that class.

Declared In

KKNodeController.h

behaviorMemberOfClass:

The class uniquely identifying the behavior.

- (id)behaviorMemberOfClass:(Class)behaviorClass

Parameters

behaviorClass

The class uniquely identifying the behavior.

Return Value

The first found behavior being a member of the class or nil if there is no behavior with that class.

Declared In

KKNodeController.h

hasBehaviors

YES if the controller has one or more behaviors.

- (BOOL)hasBehaviors

Return Value

YES if the controller has one or more behaviors.

Declared In

KKNodeController.h

initWithBehaviors:

Creates a controller with a list of behaviors.

- (id)initWithBehaviors:(NSArray *)behaviors

Parameters

behaviors

An array containing KKBehavior objects.

Return Value

A new instance.

Declared In

KKNodeController.h

isEqualToController:

- (BOOL)isEqualToController:(KKNodeController *)controller

nodeDidMoveToParent

- (void)nodeDidMoveToParent

nodeWillMoveFromParent

- (void)nodeWillMoveFromParent

removeAllBehaviors

Removes all behaviors from the controller.

- (void)removeAllBehaviors

Declared In

KKNodeController.h

removeBehavior:

Removes a specific behavior. Does nothing if the behavior isn’t in the list.

- (void)removeBehavior:(KKBehavior *)behavior

Parameters

behavior

The behavior to remove

Declared In

KKNodeController.h

removeBehaviorForKey:

Removes a specific behavior by key. Does nothing if there’s no behavior with this key in the list.

- (void)removeBehaviorForKey:(NSString *)key

Parameters

key

The key uniquely identifying the behavior to remove.

Declared In

KKNodeController.h

removeBehaviorWithClass:

Removes a specific behavior by class. Does nothing if there’s no behavior being a member of the class in the list.

- (void)removeBehaviorWithClass:(Class)behaviorClass

Parameters

behaviorClass

The behavior class to remove.

Declared In

KKNodeController.h

willRemoveController

- (void)willRemoveController