CodeSubWars 0.4.7b
CodeSubWars::CSWWeaponBattery Class Reference

#include <CSWWeaponBattery.h>

Inheritance diagram for CodeSubWars::CSWWeaponBattery:

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< CSWWeapongetNext () const
const Vector3D & getDirection () const
int getSize () const
int getNumInserted () const
bool isFull () const
bool isEmpty () const
- Public Member Functions inherited from CodeSubWars::CSWEquipment
bool isMoving () const
- Public Member Functions inherited from CodeSubWars::CSWObject
const std::string & getName () const

Detailed Description

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:

  1. the weapon will be armed (only when used releaseNext()),
  2. the weapon will be launched/released and
  3. the weapon will explode on a defined trigger.

Member Function Documentation

◆ getDirection()

const Vector3D & CodeSubWars::CSWWeaponBattery::getDirection ( ) const

Returns the direction in world coordinate system in which the weapon are launched.

The direction in world coordinate systen in which the weapon are launched.

◆ getFillLevel()

double CodeSubWars::CSWWeaponBattery::getFillLevel ( ) const

Returns the current fill level in range [0, 1].

The current fill level in range [0, 1].

Implements CodeSubWars::CSWIRechargeable.

◆ getNext()

CSWWeapon::PtrType CodeSubWars::CSWWeaponBattery::getNext ( ) const

Returns the weapon that would be launched next.

The weapon that would be released next time. If no weapon is available None will returned.

◆ getNumInserted()

int CodeSubWars::CSWWeaponBattery::getNumInserted ( ) const

Returns the current number of available weapons.

The number of currently inserted weapons.

◆ getRechargingIDs()

const unsigned long & CodeSubWars::CSWWeaponBattery::getRechargingIDs ( ) const

Signals if the recharging is currently running.

The recharging resource ids if recharging is currently running otherwise 0.

Implements CodeSubWars::CSWIRechargeable.

◆ getSize()

int CodeSubWars::CSWWeaponBattery::getSize ( ) const

Returns how many weapon can contain the weapon battery.

The capacity of the weapon battery.

◆ isEmpty()

bool CodeSubWars::CSWWeaponBattery::isEmpty ( ) const

Returns true if the battery is empty.

True if empty.

◆ isFull()

bool CodeSubWars::CSWWeaponBattery::isFull ( ) const

Returns true if the battery is full.

True if full.

◆ release()

bool CodeSubWars::CSWWeaponBattery::release ( std::shared_ptr< CSWWeapon pWeapon)

Launches a given weapon. If no weapon is given nothing will be done.

pWeaponThe weapon that should be launched.
True on success
The weapon must be arm before launch. Otherwise the weapon will never fire.

◆ releaseNext()

bool CodeSubWars::CSWWeaponBattery::releaseNext ( double  fArmDelay = 5.0)

Arms and launches the next available weapon. If no weapon is available nothing will be done.

fArmDelayThe time in seconds when the weapon should be armed.
True on success

◆ tryRecharging()

const unsigned long & CodeSubWars::CSWWeaponBattery::tryRecharging ( const std::string &  strResourceProvider,
const unsigned long &  nResourceIDs 

Tries to recharge itself by the given resource provider.

strResourceProviderThe name of the resource provider on which the object should try to recharge.
nResourceIDsThe 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.
Returns the resource ids that will be recharged. Not 0 is returned on successfully applying for recharging on the given provider for at least one requested resource otherwise 0.

Implements CodeSubWars::CSWIRechargeable.

Generated at Sun Aug 7 2022 for project CodeSubWars.