#include <CSWWeaponBattery.h>
Public Member Functions | |
virtual const unsigned long & | getRechargingIDs () const |
virtual double | getFillLevel () const |
virtual const unsigned long & | tryRecharging (const std::string &strResourceProvider, const unsigned long &nResourceIDs) |
bool | release (std::shared_ptr< CSWWeapon > pWeapon) |
bool | releaseNext (double fArmDelay=5.0) |
std::shared_ptr< CSWWeapon > | getNext () const |
const Vector3D & | getDirection () const |
int | getSize () const |
int | getNumInserted () const |
bool | isFull () const |
bool | isEmpty () const |
![]() | |
bool | isMoving () const |
![]() | |
const std::string & | getName () const |
This class provides functionality to store, launch and recharge weapons. Weapons can only launched via WeaponBatteries. At least one second should be waited between two weapon releases. Otherwise the release failed and no weapon is released. When firing a weapon through a weapon battery the following things will happen:
const Vector3D & CodeSubWars::CSWWeaponBattery::getDirection | ( | ) | const |
Returns the direction in world coordinate system in which the weapon are launched.
|
virtual |
Returns the current fill level in range [0, 1].
Implements CodeSubWars::CSWIRechargeable.
CSWWeapon::PtrType CodeSubWars::CSWWeaponBattery::getNext | ( | ) | const |
Returns the weapon that would be launched next.
int CodeSubWars::CSWWeaponBattery::getNumInserted | ( | ) | const |
Returns the current number of available weapons.
|
virtual |
Signals if the recharging is currently running.
Implements CodeSubWars::CSWIRechargeable.
int CodeSubWars::CSWWeaponBattery::getSize | ( | ) | const |
Returns how many weapon can contain the weapon battery.
bool CodeSubWars::CSWWeaponBattery::isEmpty | ( | ) | const |
Returns true if the battery is empty.
bool CodeSubWars::CSWWeaponBattery::isFull | ( | ) | const |
Returns true if the battery is full.
bool CodeSubWars::CSWWeaponBattery::release | ( | std::shared_ptr< CSWWeapon > | pWeapon | ) |
Launches a given weapon. If no weapon is given nothing will be done.
pWeapon | The weapon that should be launched. |
bool CodeSubWars::CSWWeaponBattery::releaseNext | ( | double | fArmDelay = 5.0 | ) |
Arms and launches the next available weapon. If no weapon is available nothing will be done.
fArmDelay | The time in seconds when the weapon should be armed. |
|
virtual |
Tries to recharge itself by the given resource provider.
strResourceProvider | The name of the resource provider on which the object should try to recharge. |
nResourceIDs | The bitwise ORed resources that should be recharged by the requested provider. This should be a subset of the resources that this rechargeable object could contain. |
Implements CodeSubWars::CSWIRechargeable.