Instance Method

setObject:forKeyedSubscript:

Sets the weight for the goal specified by subscript syntax.

Declaration

- (void)setObject:(NSNumber *)weight forKeyedSubscript:(GKGoal *)goal;

Parameters

weight

A weight to be applied to the goal’s influence on an agent’s speed and direction.

goal

A goal object.

Discussion

This method is equivalent to the setWeight:forGoal: method, but allows access using subscript syntax. Like that method, setting a goal weight by subscript adds the specified goal to the behavior if not already present.

See Also

Working with Goals Using Subscript Syntax

- objectForKeyedSubscript:

Returns the weight associated with the goal specified by subscript syntax.

- objectAtIndexedSubscript:

Returns the goal at the specified index in the behavior’s list of goals.