Orxonox: orxonox::WeaponMode Class Reference

# orxonox::WeaponMode Class Reference

`#include <src/orxonox/objects/weaponsystem/WeaponMode.h>`

Inheritance diagram for orxonox::WeaponMode:

List of all members.

## Public Member Functions

bool | fire (float *reloadTime)
bool | getAutoReload () const
float | getDamage () const
unsigned int | getInitialMagazines () const
unsigned int | getInitialMunition () const
unsigned int | getMode () const
Munition * | getMunition () const
const std::string & | getMunitionName () const
unsigned int | getMunitionPerShot () const
Identifier * | getMunitionType () const
Vector3 | getMuzzleDirection () const
const Vector3 & | getMuzzleOffset () const
const Quaternion & | getMuzzleOrientation () const
Vector3 | getMuzzlePosition () const
bool | getParallelReload () const
float | getReloadTime () const
Weapon * | getWeapon () const
bool | reload ()
void | setAutoReload (bool autoreload)
void | setDamage (float damage)
void | setInitialMagazines (unsigned int amount)
void | setInitialMunition (unsigned int amount)
void | setMode (unsigned int mode)
void | setMunitionName (const std::string &munitionname)
void | setMunitionPerShot (unsigned int amount)
void | setMunitionType (Identifier *identifier)
void | setMuzzleOffset (const Vector3 &offset)
void | setParallelReload (bool parallelreload)
void | setReloadTime (float time)
void | setWeapon (Weapon *weapon)
| WeaponMode (BaseObject *creator)
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode)
| XML loading and saving.
virtual | ~WeaponMode ()

## Protected Member Functions

virtual void | fire ()=0

## Protected Attributes

bool | bAutoReload_
bool | bParallelReload_
float | damage_
unsigned int | initialMagazines_
unsigned int | initialMunition_
unsigned int | munitionPerShot_
Vector3 | muzzleOffset_
float | reloadTime_

## Private Member Functions

void | reloaded ()
void | updateMunition ()

## Private Attributes

bool | bReloading_
unsigned int | mode_
Munition * | munition_
std::string | munitionname_
SubclassIdentifier< Munition > | munitiontype_
Timer< WeaponMode > | reloadTimer_
Weapon * | weapon_

## Constructor & Destructor Documentation

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

References bAutoReload_, bParallelReload_, bReloading_, orxonox::createExecutor(), damage_, initialMagazines_, initialMunition_, mode_, munition_, munitionPerShot_, muzzleOffset_, RegisterObject, reloaded(), reloadTime_, reloadTimer_, weapon_, and orxonox::WeaponSystem::WEAPON_MODE_UNASSIGNED.

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

## Member Function Documentation

virtual void orxonox::WeaponMode::fire | ( |  | ) | `[protected, pure virtual]`

Implemented in orxonox::EnergyDrink, orxonox::FusionFire, orxonox::HsW01, orxonox::LaserFire, and orxonox::LightningGun.

Referenced by fire().

bool orxonox::WeaponMode::fire | ( | float * | reloadTime | ) |

References bAutoReload_, bParallelReload_, bReloading_, fire(), orxonox::Munition::getReloadTime(), munition_, orxonox::Munition::needReload(), orxonox::Munition::reload(), reloadTime_, reloadTimer_, and orxonox::Munition::takeMunition().

bool orxonox::WeaponMode::getAutoReload | ( |  | ) | const`[inline]`

Referenced by XMLPort().

float orxonox::WeaponMode::getDamage | ( |  | ) | const`[inline]`

Referenced by orxonox::LightningGun::fire(), orxonox::LaserFire::fire(), orxonox::FusionFire::fire(), orxonox::HsW01::shot(), orxonox::EnergyDrink::shot(), and XMLPort().

unsigned int orxonox::WeaponMode::getInitialMagazines | ( |  | ) | const`[inline]`

Referenced by XMLPort().

unsigned int orxonox::WeaponMode::getInitialMunition | ( |  | ) | const`[inline]`

Referenced by XMLPort().

unsigned int orxonox::WeaponMode::getMode | ( | void |  | ) | const`[inline]`

Referenced by orxonox::Weapon::addWeaponmode(), and XMLPort().

Munition* orxonox::WeaponMode::getMunition | ( |  | ) | const`[inline]`

const std::string& orxonox::WeaponMode::getMunitionName | ( |  | ) | const`[inline]`

Referenced by XMLPort().

unsigned int orxonox::WeaponMode::getMunitionPerShot | ( |  | ) | const`[inline]`

Referenced by XMLPort().

Identifier* orxonox::WeaponMode::getMunitionType | ( |  | ) | const`[inline]`

Vector3 orxonox::WeaponMode::getMuzzleDirection | ( |  | ) | const

References orxonox::WorldEntity::FRONT, orxonox::WorldEntity::getWorldOrientation(), and weapon_.

Referenced by orxonox::LightningGun::fire(), orxonox::LaserFire::fire(), orxonox::FusionFire::fire(), orxonox::HsW01::shot(), and orxonox::EnergyDrink::shot().

const Vector3& orxonox::WeaponMode::getMuzzleOffset | ( |  | ) | const`[inline]`

Referenced by orxonox::HsW01::muendungsfeuer(), orxonox::EnergyDrink::muendungsfeuer(), and XMLPort().

const Quaternion & orxonox::WeaponMode::getMuzzleOrientation | ( |  | ) | const

References orxonox::WorldEntity::getWorldOrientation(), and weapon_.

Referenced by orxonox::LightningGun::fire(), orxonox::LaserFire::fire(), orxonox::FusionFire::fire(), orxonox::HsW01::shot(), and orxonox::EnergyDrink::shot().

Vector3 orxonox::WeaponMode::getMuzzlePosition | ( |  | ) | const

References orxonox::WorldEntity::getWorldOrientation(), orxonox::WorldEntity::getWorldPosition(), muzzleOffset_, and weapon_.

Referenced by orxonox::LightningGun::fire(), orxonox::LaserFire::fire(), orxonox::FusionFire::fire(), orxonox::HsW01::shot(), and orxonox::EnergyDrink::shot().

bool orxonox::WeaponMode::getParallelReload | ( |  | ) | const`[inline]`

Referenced by XMLPort().

float orxonox::WeaponMode::getReloadTime | ( |  | ) | const`[inline]`

Referenced by XMLPort().

Weapon* orxonox::WeaponMode::getWeapon | ( |  | ) | const`[inline]`

Referenced by orxonox::LightningGun::fire(), orxonox::LaserFire::fire(), orxonox::FusionFire::fire(), orxonox::HsW01::muendungsfeuer(), orxonox::EnergyDrink::muendungsfeuer(), orxonox::HsW01::shot(), and orxonox::EnergyDrink::shot().

bool orxonox::WeaponMode::reload | ( |  | ) |

References bParallelReload_, bReloading_, orxonox::Munition::getReloadTime(), munition_, orxonox::Munition::reload(), reloadTime_, and reloadTimer_.

void orxonox::WeaponMode::reloaded | ( |  | ) | `[private]`

References bReloading_.

Referenced by WeaponMode().

void orxonox::WeaponMode::setAutoReload | ( | bool | autoreload | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setDamage | ( | float | damage | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setInitialMagazines | ( | unsigned int | amount | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setInitialMunition | ( | unsigned int | amount | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setMode | ( | unsigned int | mode | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setMunitionName | ( | const std::string & | munitionname | ) |

References ClassByString, munitionname_, munitiontype_, and updateMunition().

Referenced by orxonox::EnergyDrink::EnergyDrink(), orxonox::FusionFire::FusionFire(), orxonox::HsW01::HsW01(), orxonox::LaserFire::LaserFire(), orxonox::LightningGun::LightningGun(), and XMLPort().

void orxonox::WeaponMode::setMunitionPerShot | ( | unsigned int | amount | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setMunitionType | ( | Identifier * | identifier | ) |

References orxonox::Identifier::getName(), munitionname_, munitiontype_, and updateMunition().

void orxonox::WeaponMode::setMuzzleOffset | ( | const Vector3 & | offset | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setParallelReload | ( | bool | parallelreload | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setReloadTime | ( | float | time | ) | `[inline]`

Referenced by XMLPort().

void orxonox::WeaponMode::setWeapon | ( | Weapon * | weapon | ) | `[inline]`

Referenced by orxonox::Weapon::addWeaponmode().

void orxonox::WeaponMode::updateMunition | ( |  | ) | `[private]`

References orxonox::Munition::addMagazines(), orxonox::Munition::addMunition(), orxonox::Munition::getMaxMunitionPerMagazine(), orxonox::WeaponSystem::getMunition(), orxonox::Munition::getNumMunitionInCurrentMagazine(), orxonox::Weapon::getWeaponPack(), orxonox::WeaponPack::getWeaponSystem(), initialMagazines_, initialMunition_, munition_, munitiontype_, orxonox::Munition::needReload(), orxonox::Munition::reload(), orxonox::Munition::takeMunition(), and weapon_.

Referenced by setMunitionName(), and setMunitionType().

void orxonox::WeaponMode::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::BaseObject.

Reimplemented in orxonox::EnergyDrink, and orxonox::HsW01.

References getAutoReload(), getDamage(), getInitialMagazines(), getInitialMunition(), getMode(), getMunitionName(), getMunitionPerShot(), getMuzzleOffset(), getParallelReload(), getReloadTime(), setAutoReload(), setDamage(), setInitialMagazines(), setInitialMunition(), setMode(), setMunitionName(), setMunitionPerShot(), setMuzzleOffset(), setParallelReload(), setReloadTime(), SUPER, and XMLPortParam.

## Member Data Documentation

bool orxonox::WeaponMode::bAutoReload_`[protected]`

Referenced by fire(), and WeaponMode().

bool orxonox::WeaponMode::bParallelReload_`[protected]`

Referenced by fire(), orxonox::FusionFire::FusionFire(), reload(), and WeaponMode().

bool orxonox::WeaponMode::bReloading_`[private]`

Referenced by fire(), reload(), reloaded(), and WeaponMode().

float orxonox::WeaponMode::damage_`[protected]`

Referenced by orxonox::EnergyDrink::EnergyDrink(), orxonox::FusionFire::FusionFire(), orxonox::HsW01::HsW01(), orxonox::LaserFire::LaserFire(), orxonox::LightningGun::LightningGun(), and WeaponMode().

unsigned int orxonox::WeaponMode::initialMagazines_`[protected]`

Referenced by updateMunition(), and WeaponMode().

unsigned int orxonox::WeaponMode::initialMunition_`[protected]`

Referenced by updateMunition(), and WeaponMode().

unsigned int orxonox::WeaponMode::mode_`[private]`

Referenced by WeaponMode().

Munition* orxonox::WeaponMode::munition_`[private]`

Referenced by fire(), reload(), updateMunition(), and WeaponMode().

std::string orxonox::WeaponMode::munitionname_`[private]`

Referenced by setMunitionName(), and setMunitionType().

unsigned int orxonox::WeaponMode::munitionPerShot_`[protected]`

Referenced by WeaponMode().

SubclassIdentifier<Munition> orxonox::WeaponMode::munitiontype_`[private]`

Referenced by setMunitionName(), setMunitionType(), and updateMunition().

Vector3 orxonox::WeaponMode::muzzleOffset_`[protected]`

Referenced by getMuzzlePosition(), and WeaponMode().

float orxonox::WeaponMode::reloadTime_`[protected]`

Referenced by orxonox::EnergyDrink::EnergyDrink(), fire(), orxonox::FusionFire::FusionFire(), orxonox::HsW01::HsW01(), orxonox::LaserFire::LaserFire(), orxonox::LightningGun::LightningGun(), reload(), and WeaponMode().

Timer<WeaponMode> orxonox::WeaponMode::reloadTimer_`[private]`

Referenced by fire(), reload(), and WeaponMode().

Weapon* orxonox::WeaponMode::weapon_`[private]`

Referenced by getMuzzleDirection(), getMuzzleOrientation(), getMuzzlePosition(), updateMunition(), and WeaponMode().

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

- src/orxonox/objects/weaponsystem/WeaponMode.h
- src/orxonox/objects/weaponsystem/WeaponMode.cc