GKAgentDelegate
Implement this protocol to synchronize the state of an agent with its visual representation in your game.
Method Summary
Public Methods | ||
public |
agentDidUpdate(agent: GKAgent): void Implement this method when you want to update a display based on the latest data from the agent simulation. |
|
public |
agentWillUpdate(agent: GKAgent): void Implement this method when you want to update the agent simulation with data from an external source, such as node position and orientation information updated by the SceneKit or SpriteKit physics engine. |
Public Methods
public agentDidUpdate(agent: GKAgent): void source
Implement this method when you want to update a display based on the latest data from the agent simulation. Read the position and rotation properties of the agent (as a GKAgent2D or GKAgent3D object), then set the corresponding attributes of the object that provides the agent’s visual representation.
Params:
Name | Type | Attribute | Description |
agent | GKAgent | The agent object that has just performed a simulation step. |
Return:
void |
public agentWillUpdate(agent: GKAgent): void source
Implement this method when you want to update the agent simulation with data from an external source, such as node position and orientation information updated by the SceneKit or SpriteKit physics engine. Set the position and rotation properties of the agent (as a GKAgent2D or GKAgent3D object) so that the next simulation step will take your changes to those properties into account.
Params:
Name | Type | Attribute | Description |
agent | GKAgent | The agent object that will perform its next simulation step. |
Return:
void |