Orxonox: orxonox::Trigger Class Reference

# orxonox::Trigger Class Reference

`#include <src/orxonox/objects/worldentities/triggers/Trigger.h>`

Inheritance diagram for orxonox::Trigger:

List of all members.

## Public Member Functions

void | addTrigger (Trigger *trigger)
virtual void | changedVisibility ()
| This function gets called if the visibility of the object changes.
int | getActivations () const
float | getDelay () const
bool | getInvert () const
TriggerMode::Value | getMode () const
bool | getStayActive () const
bool | getSwitch () const
const Trigger * | getTrigger (unsigned int index) const
bool | isActive () const
| Returns the state of the objects activity.
void | setActivations (int activations)
void | setDelay (float delay)
void | setInvert (bool bInvert)
void | setMode (TriggerMode::Value mode)
void | setMode (const std::string &modeName)
void | setStayActive (bool bStayActive)
void | setSwitch (bool bSwitch)
void | setVisible (bool visibility)
| Sets the state of the objects visibility.
bool | switchState ()
virtual void | tick (float dt)
| Gets called every frame.
| Trigger (BaseObject *creator)
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode)
| XML loading and saving.
virtual | ~Trigger ()

## Static Public Member Functions

static void | debugFlares (bool bVisible)

## Protected Member Functions

virtual bool | isTriggered (TriggerMode::Value mode)
bool | isTriggered ()
virtual void | triggered (bool bIsTriggered)

## Private Member Functions

bool | checkAnd ()
bool | checkOr ()
bool | checkXor ()
std::string | getModeString () const
void | setBillboardColour (const ColourValue &colour)
void | storeState ()

## Private Attributes

bool | bActive_
| True = the object is active.
bool | bFirstTick_
bool | bInvertMode_
bool | bStayActive_
bool | bSwitch_
bool | bTriggered_
std::set< Trigger * > | children_
BillboardSet | debugBillboard_
float | delay_
char | latestState_
TriggerMode::Value | mode_
int | remainingActivations_
float | remainingTime_
std::queue< std::pair< float, char > > | stateChanges_
float | timeSinceLastEvent_

## Constructor & Destructor Documentation

orxonox::Trigger::Trigger | ( | BaseObject * | creator | ) |

References orxonox::WorldEntity::attachOgreObject(), bActive_, bFirstTick_, bInvertMode_, bStayActive_, bSwitch_, bTriggered_, orxonox::MT_Type::ColourValue, debugBillboard_, delay_, orxonox::TriggerMode::EventTriggerAND, orxonox::BillboardSet::getBillboardSet(), orxonox::BaseObject::getScene(), latestState_, mode_, RegisterObject, remainingActivations_, remainingTime_, orxonox::BillboardSet::setBillboardSet(), orxonox::Synchronisable::setObjectMode(), orxonox::BillboardSet::setVisible(), orxonox::GameMode::showsGraphics(), and timeSinceLastEvent_.

orxonox::Trigger::~Trigger | ( |  | ) | `[virtual]`

## Member Function Documentation

void orxonox::Trigger::addTrigger | ( | Trigger * | trigger | ) |

References children_.

Referenced by XMLPort().

void orxonox::Trigger::changedVisibility | ( |  | ) | `[virtual]`

This function gets called if the visibility of the object changes.

Reimplemented from orxonox::BaseObject.

References debugBillboard_, orxonox::BaseObject::isVisible(), orxonox::BillboardSet::setVisible(), and SUPER.

bool orxonox::Trigger::checkAnd | ( |  | ) | `[private]`

References children_.

Referenced by isTriggered().

bool orxonox::Trigger::checkOr | ( |  | ) | `[private]`

References children_.

Referenced by isTriggered().

bool orxonox::Trigger::checkXor | ( |  | ) | `[private]`

References children_.

Referenced by isTriggered().

void orxonox::Trigger::debugFlares | ( | bool | bVisible | ) | `[static]`

int orxonox::Trigger::getActivations | ( |  | ) | const`[inline]`

Referenced by XMLPort().

float orxonox::Trigger::getDelay | ( |  | ) | const`[inline]`

Referenced by XMLPort().

bool orxonox::Trigger::getInvert | ( |  | ) | const`[inline]`

Referenced by XMLPort().

TriggerMode::Value orxonox::Trigger::getMode | ( | void |  | ) | const`[inline]`

std::string orxonox::Trigger::getModeString | ( |  | ) | const`[private]`

References orxonox::TriggerMode::EventTriggerAND, orxonox::TriggerMode::EventTriggerOR, orxonox::TriggerMode::EventTriggerXOR, and mode_.

Referenced by XMLPort().

bool orxonox::Trigger::getStayActive | ( |  | ) | const`[inline]`

Referenced by XMLPort().

bool orxonox::Trigger::getSwitch | ( |  | ) | const`[inline]`

Referenced by XMLPort().

const Trigger * orxonox::Trigger::getTrigger | ( | unsigned int | index | ) | const

References children_.

Referenced by XMLPort().

bool orxonox::Trigger::isActive | ( | void |  | ) | const`[inline]`

Returns the state of the objects activity.

Returns:
  The state of the activity

Reimplemented from orxonox::BaseObject.

bool orxonox::Trigger::isTriggered | ( | TriggerMode::Value | mode | ) | `[protected, virtual]`

Reimplemented in orxonox::DistanceTrigger, orxonox::EventTrigger, and orxonox::PlayerTrigger.

References checkAnd(), checkOr(), checkXor(), children_, orxonox::TriggerMode::EventTriggerAND, orxonox::TriggerMode::EventTriggerOR, and orxonox::TriggerMode::EventTriggerXOR.

bool orxonox::Trigger::isTriggered | ( |  | ) | `[inline, protected]`

Referenced by orxonox::EventTrigger::isTriggered(), orxonox::DistanceTrigger::isTriggered(), and tick().

void orxonox::Trigger::setActivations | ( | int | activations | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Trigger::setBillboardColour | ( | const ColourValue & | colour | ) | `[private]`

References debugBillboard_, and orxonox::BillboardSet::setColour().

Referenced by tick().

void orxonox::Trigger::setDelay | ( | float | delay | ) |

References delay_, and timeSinceLastEvent_.

Referenced by XMLPort().

void orxonox::Trigger::setInvert | ( | bool | bInvert | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Trigger::setMode | ( | TriggerMode::Value | mode | ) | `[inline]`

void orxonox::Trigger::setMode | ( | const std::string & | modeName | ) |

References orxonox::TriggerMode::EventTriggerAND, orxonox::TriggerMode::EventTriggerOR, and orxonox::TriggerMode::EventTriggerXOR.

Referenced by XMLPort().

void orxonox::Trigger::setStayActive | ( | bool | bStayActive | ) | `[inline]`

Referenced by orxonox::CheckPoint::CheckPoint(), and XMLPort().

void orxonox::Trigger::setSwitch | ( | bool | bSwitch | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Trigger::setVisible | ( | bool | bVisible | ) | `[inline]`

Sets the state of the objects visibility.

Parameters:

  | bVisible | True = visible

Reimplemented from orxonox::BaseObject.

void orxonox::Trigger::storeState | ( |  | ) | `[private]`

References latestState_, remainingTime_, stateChanges_, and timeSinceLastEvent_.

Referenced by switchState().

bool orxonox::Trigger::switchState | ( |  | ) |

References bStayActive_, latestState_, remainingActivations_, and storeState().

Referenced by tick().

void orxonox::Trigger::tick | ( | float | dt | ) | `[virtual]`

Gets called every frame.

Parameters:

  | dt | The time since the last frame in seconds

Implements orxonox::Tickable.

References bActive_, bFirstTick_, bInvertMode_, bSwitch_, bTriggered_, orxonox::MT_Type::ColourValue, delay_, orxonox::BaseObject::isActive(), isTriggered(), latestState_, remainingTime_, setBillboardColour(), stateChanges_, SUPER, switchState(), timeSinceLastEvent_, and triggered().

void orxonox::Trigger::triggered | ( | bool | bIsTriggered | ) | `[protected, virtual]`

Reimplemented in orxonox::CheckPoint.

References orxonox::BaseObject::fireEvent().

Referenced by tick(), and orxonox::CheckPoint::triggered().

void orxonox::Trigger::XMLPort | ( | Element & | xmlelement,
|  | XMLPort::Mode | mode |
| ) |  |  | `[virtual]`

XML loading and saving.

Parameters:

  | xmlelement | The XML-element
  | loading | Loading (true) or saving (false)

Returns:
  The XML-element

Reimplemented from orxonox::WorldEntity.

Reimplemented in orxonox::CheckPoint, orxonox::DistanceTrigger, and orxonox::PlayerTrigger.

References addTrigger(), getActivations(), getDelay(), getInvert(), getModeString(), getStayActive(), getSwitch(), getTrigger(), setActivations(), setDelay(), setInvert(), setMode(), setStayActive(), setSwitch(), SUPER, XMLPortObject, XMLPortParam, and XMLPortParamTemplate.

## Member Data Documentation

bool orxonox::Trigger::bActive_`[private]`

True = the object is active.

Reimplemented from orxonox::BaseObject.

Referenced by tick(), and Trigger().

bool orxonox::Trigger::bFirstTick_`[private]`

Referenced by tick(), and Trigger().

bool orxonox::Trigger::bInvertMode_`[private]`

Referenced by tick(), and Trigger().

bool orxonox::Trigger::bStayActive_`[private]`

Referenced by switchState(), and Trigger().

bool orxonox::Trigger::bSwitch_`[private]`

Referenced by tick(), and Trigger().

bool orxonox::Trigger::bTriggered_`[private]`

Referenced by tick(), and Trigger().

std::set<Trigger*> orxonox::Trigger::children_`[private]`

Reimplemented from orxonox::WorldEntity.

Referenced by addTrigger(), checkAnd(), checkOr(), checkXor(), getTrigger(), and isTriggered().

BillboardSet orxonox::Trigger::debugBillboard_`[private]`

Referenced by changedVisibility(), setBillboardColour(), and Trigger().

float orxonox::Trigger::delay_`[private]`

Referenced by setDelay(), tick(), and Trigger().

char orxonox::Trigger::latestState_`[private]`

Referenced by storeState(), switchState(), tick(), and Trigger().

TriggerMode::Value orxonox::Trigger::mode_`[private]`

Referenced by getModeString(), and Trigger().

int orxonox::Trigger::remainingActivations_`[private]`

Referenced by switchState(), and Trigger().

float orxonox::Trigger::remainingTime_`[private]`

Referenced by storeState(), tick(), and Trigger().

std::queue<std::pair<float, char> > orxonox::Trigger::stateChanges_`[private]`

Referenced by storeState(), and tick().

float orxonox::Trigger::timeSinceLastEvent_`[private]`

Referenced by setDelay(), storeState(), tick(), and Trigger().

The documentation for this class was generated from the following files:

- src/orxonox/objects/worldentities/triggers/Trigger.h
- src/orxonox/objects/worldentities/triggers/Trigger.cc