Initializer

init(behaviors:)

Creates a composite behavior from the specified individual behaviors.

Declaration

convenience init(behaviors: [GKBehavior])

Parameters

behaviors

An array of behavior objects.

Return Value

A new behavior object. To assign a behavior to an agent, use the agent’s behavior property.

Discussion

The new behavior contains the specified behaviors, each with a weight of 1.0. To change an individual behavior’s weight after creating the composite behavior, keep a reference to that behavior and use the setWeight(_:for:) method.

See Also

Creating a Composite Behavior

init(behaviors: [GKBehavior], andWeights: [NSNumber])

Creates a behavior with the specified behaviors and weights.