# HBhvAction

## Functions

| `HBhvAction`
| `~HBhvAction`
void | `SetTargetByPath`
void | `DoAction`
void | `Serialize`
void * | `XMLCallback`

## Detailed Description

class HBhvAction

  The HBhvAction class encapsulates an animation action.

  An action is executed based on the status of all conditions of the sensor it belongs to. Certain action types are directly related to specific target types. The following is a list of action types and targets.

  Action Type: DOACTION

  Associate Target Type: None

  Action: Triggers a sensor action event.

  Action Type: LOADFILE

  Associate Target Type: None

  Action: Load a file with the path indicated the value paramater.

  Action Type: ACTIVATE

  Associated Target Type: Animation

  Action: Activate the target animation and then schedules it for execution. A delay before execution can be indicated by passing the number ticks to the value parameter in the constructor.

  Action Type: CONTINUE

  Associated Target Type: Animation

  Action: Removes the target animation from the schedule animation list and then reschedules it for later.

  Action Type: DEACTIVATE

  Associated Target Type: Animation

  Action: Removes the target animation from the schedule animation list and set its currently running flag to false.

  Action Type: ACTIVATE

  Associated Target Type: Sensor

  Action: Activates the target sensor. A delay before execution can be indicated by passing the number ticks to the value parameter in the constructor.

  Action Type: DEACTIVATE

  Associated Target Type: Sensor

  Action: Deactivates the target sensor.

  Public Functions

  HBhvAction(const char *target, const char *type, const char *value, HBhvSensor *sensor)

    Constructs an HBhvAction object.

    Parameters

      - target – The descriptor for the target object for this action. You can use HBhvTargetObject::CreateTargetString() to generate this string.

      - type – The action type which are described in the detailed description of this class.

      - value – Additional data depending on the action type and target type.

      - sensor – A pointer to the HBhvSensor object that this action belongs to.

  virtual ~HBhvAction()

    Destructor for HBhvAction object.

  void SetTargetByPath(const char *targetpath)

    Sets target object for the action.

    Parameters

      target – The descriptor for the target object for this action. You can use HBhvTargetObject::CreateTargetString() to generate this string.

  void DoAction()

    Performs action based on the action type.

  void Serialize(HUtilityXMLGenerator *xmlgen)

    Writes XML data to a buffer.

  Public Static Functions

  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)

    This is XML read callback which parses XML data and then populates the member variables with the associated values.