Class PercentageDamage
Class that represents a specific type of IDamage: PercentageDamage. This class uses the base IDamage structure to apply damage based on a percentage of the current health.
Inheritance
Implements
Namespace: CatchIo.Runtime.Damages
Assembly: cs.temp.dll.dll
Syntax
public class PercentageDamage : IDamage
Constructors
PercentageDamage(Single, DamageSfxType)
Constructor to initialize the PercentageDamage object with a specified percentage and SFX type.
Declaration
public PercentageDamage(float percentage, DamageSfxType sfxType)
Parameters
Type | Name | Description |
---|---|---|
System.Single | percentage | The percentage of the current health that will be applied as damage. |
DamageSfxType | sfxType | The sound effect type that will play when the damage is applied. |
Methods
GetDamage()
Returns the percentage value used for calculating damage. This value is multiplied by the current health to determine the actual damage dealt. For example, the damage dealt is calculated as: CurrentHealth * GetDamage().
Declaration
public float GetDamage()
Returns
Type | Description |
---|---|
System.Single | A float representing the percentage value. |
GetSfxType()
Returns the type of sound effect (SFX) associated with this damage instance.
Declaration
public DamageSfxType GetSfxType()
Returns
Type | Description |
---|---|
DamageSfxType | The DamageSfxType value indicating which sound effect to play. |