|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | Static Public Member Functions
gameplay::AIAgent Class Reference

`#include <AIAgent.h>`

Inheritance diagram for gameplay::AIAgent:

List of all members.

## Classes

class | Listener

## Public Member Functions

const char * | getId () const
Node * | getNode () const
AIStateMachine * | getStateMachine ()
bool | isEnabled () const
void | setEnabled (bool enabled)
void | setListener (Listener *listener)

## Static Public Member Functions

static AIAgent * | create ()

## Detailed Description

Defines an AI agent that can be added to nodes in a scene.

Agents represent a unit of intelligence in a game and can be used to program logic for a character or object in a game, using constructs such as state machines. By default, an AIAgent has an empty state machine.

## Member Function Documentation

static AIAgent* gameplay::AIAgent::create | ( |  | ) | `[static]`

Creates a new AIAgent.

Returns:
  A new AIAgent.

const char* gameplay::AIAgent::getId | ( |  | ) | const

Returns the identifier for the AIAgent.

This method simply returns the ID of the Node which this AIAgent is bound to. If this AIAgent is not bound to a Node, this method returns an empty string.

Returns:
  The identifier for the agent.

Node* gameplay::AIAgent::getNode | ( |  | ) | const

Returns the Node this AIAgent is assigned to.

Returns:
  The Node this agent is assigned to.

AIStateMachine* gameplay::AIAgent::getStateMachine | ( |  | ) |

Returns the state machine for the AIAgent.

Returns:
  The agent's state machine.

bool gameplay::AIAgent::isEnabled | ( |  | ) | const

Determines if this AIAgent is currently enabled.

Agents are always disabled until they have been associated with a valid Node though Node::setAgent(AIAgent*). In addition, an AIAgent can be explicitly enabled or disabled using the setEnabled(bool) method.

Returns:
  true if the agent is enabled, false otherwise.

void gameplay::AIAgent::setEnabled | ( | bool | enabled | ) |

Sets whether this AIAgent is enabled.

By default, AIAgents are enabled and they can receive messages and state changes. When disabled, AIAgents stop receiving messages and their state machines are halted until they are re-enabled.

Parameters:

  enabled | true if the AIAgent should be enabled, false otherwise.

void gameplay::AIAgent::setListener | ( | Listener * | listener | ) |

Sets an event listener for this AIAgent.

Parameters:

  listener | The new AIAgent listener, or NULL to remove any existing listener.

All Classes Functions Variables Typedefs Enumerations Enumerator