#include <DamageFX.h>
Public Member Functions | |
| DamageFX () | |
| void | clear () |
| void | doDamageFX (DamageType t, Real damageAmount, const Object *source, const Object *victim) const |
| UnsignedInt | getDamageFXThrottleTime (DamageType t, const Object *source) const |
| const FieldParse * | getFieldParse () const |
A DamageFX is an object used to describe how an object reacts to taking a particular type of damage. (Note that "reacts" here implies only audio-video effects, not logic effects, damage modifiers, etc.)
Conceptually speaking, every unit with a Body module has a DamageFX object. When it receives damage, it asks its DamageFX module to produce an appropriate a/v effect, which can vary by type of damage (eg, explosion, armor-piercing, flame, etc) and amount ("minor" or "major").
Notes:
– Every particular damage-type within a DamageFX can have a "minor" and/or "major" effect; basically, if the damage done exceeds a specified threshold (or if there isn't a "minor" effect), the major effect is used.
– DamageFX is shared between multiple units; there should generally only be one instance of any particular class. The implication is that it should not require private data storage to do what it needs to do, aside from stuff initialized at object instantiation time. To help enforce this, all it's methods are declared 'const'. If you can't implement the damage you need within this framework, please don't simply de-const things, because it could lead to very strange side-effects. Instead, the system will have to be enhanced to allow for multiple instances of each DamageFX.
Definition at line 74 of file DamageFX.h.
| DamageFX::DamageFX | ( | ) |
Definition at line 66 of file DamageFX.cpp.
| void DamageFX::clear | ( | ) |
Definition at line 73 of file DamageFX.cpp.
| void DamageFX::doDamageFX | ( | DamageType | t, |
| Real | damageAmount, | ||
| const Object * | source, | ||
| const Object * | victim ) const |
This is the main public access point to the system: when you want to execute the a/v fx used for a specific damage type, call this method. (It is OK for source and/or victim to be null, but you should pass them when available.)
Definition at line 91 of file DamageFX.cpp.
| UnsignedInt DamageFX::getDamageFXThrottleTime | ( | DamageType | t, |
| const Object * | source ) const |
Definition at line 85 of file DamageFX.cpp.
| const FieldParse * DamageFX::getFieldParse | ( | ) | const |
Definition at line 121 of file DamageFX.cpp.