KKBehavior Class Reference
Inherits from | NSObject |
Conforms to | NSCoding NSCopying |
Declared in | KKBehavior.h |
Overview
Behaviors add custom logic to a node. Behaviors differ from actions in several ways:
- they are useful for any logic code that is hard or impossible to implement with (custom) actions, such as event processing
- they usually run indefinitely and can be paused by pausing the controller
- they may have a state (ivars)
- they may have a public interface (properties, methods)
- they can not be reversed
Tasks
Properties
-
key
property -
name
property -
controller
property -
node
property -
enabled
property
Create Behavior
Behavior Events
Notifications
Properties
controller
The behavior’s node controller.
@property (atomic, weak) KKNodeController *controller
Return Value
The behavior’s node controller.
Declared In
KKBehavior.h
enabled
Whether the behavior is enabled. Disabled behaviors don’t receive update messages.
@property (atomic) BOOL enabled
Return Value
Whether the behavior is enabled. Disabled behaviors don’t receive update messages.
Declared In
KKBehavior.h
key
The behavior’s uniquely identifying key.
@property (atomic, copy) NSString *key
Return Value
The behavior’s uniquely identifying key.
Declared In
KKBehavior.h
Instance Methods
didInitialize
Sent when the behavior is first created.
- (void)didInitialize
Declared In
KKBehavior.h
internal_joinController:withKey:
- (void)internal_joinController:(KKNodeController *)controller withKey:(NSString *)key
postNotificationName:
Posts a notification to notification center, with userInfo “behavior” key pointing to the sending behavior object.
- (void)postNotificationName:(NSString *)name
Parameters
- name
The uniquely identifying name of the notification.
Declared In
KKBehavior.h
postNotificationName:userInfo:
Posts a notification to notification center, with userInfo “behavior” key pointing to the sending behavior object, and custom userInfo keys.
- (void)postNotificationName:(NSString *)name userInfo:(NSDictionary *)userInfo
Parameters
- name
The uniquely identifying name of the notification.
Declared In
KKBehavior.h
removeFromNode
Removes the behavior from its owning node and controller.
- (void)removeFromNode
Declared In
KKBehavior.h