CodeSubWars 0.4.7b
CodeSubWars::CSWWeapon Class Reference

#include <CSWWeapon.h>

Inheritance diagram for CodeSubWars::CSWWeapon:

Public Member Functions

virtual bool arm (double fArmDelay)
 
virtual bool fire (double fFireDelay)
 
- Public Member Functions inherited from CodeSubWars::CSWObject
const std::string & getName () const
 

Detailed Description

This is the base class for all weapons within the world. A weapon is a thing that can causes damage to other damagable objects. The damage height to other objects is depend on its size. Larger weapon causes higher damage. This has the property to emit sound on its explosion that is depend on the explosion power.

Warning
Weapons can only be launched through a weaponbattery! Otherwise the object will not inserted into the object tree.

Member Function Documentation

◆ arm()

bool CodeSubWars::CSWWeapon::arm ( double  fArmDelay)
virtual

Sets the relative time from now when the weapon will be armed. Only if a weapon is armed it could explode. This is only available if the weapon was not launched.

Parameters
fArmDelayThe time from now in seconds when the weapon is armed.
Returns
True on success.
Warning
If the absolute time for fire is earlier than the absolute arm time, the fire time will be set to arm time.

◆ fire()

bool CodeSubWars::CSWWeapon::fire ( double  fFireDelay)
virtual

Sets the relative time from now when the weapon will be fired. This time should be larger than the arm delay. This is only available if the weapon was not launched.

Parameters
fFireDelayThe time from now in seconds when the weapon is fired.
Returns
True on success.
Warning
If the absolute time for fire is earlier than the absolute arm time, the arm time will be set to fire time.

Generated at Sun Aug 7 2022 for project CodeSubWars. www.codesubwars.org