HazardSystem

Manages hazard zones with periodic damage ticks and elevation awareness.

Constructor

new HazardSystem()

Classes

HazardSystem

Methods

addZone(config) → {string}

Register a hazard zone.

Parameters:
NameTypeDescription
configObject
Properties
NameTypeAttributesDefaultDescription
boundsObject

{ left, right, top, bottom }

elevationnumber<optional>
0
heightnumber<optional>
2
damagePerTicknumber<optional>
10
tickIntervalnumber<optional>
0.5
damageTypestring<optional>
"hazard"
Returns:

Zone ID

Type: 
string

step(deltaTime, targets) → {Array.<Object>}

Step hazard zones against targets (combatants/entities). Targets only take damage if their 2D bounds overlap AND their elevation intervals overlap.

Parameters:
NameTypeDescription
deltaTimenumber
targetsArray.<Object>

Array of { id, bounds, elevation?, height?, receiveDamage }

Returns:

List of damage events applied

Type: 
Array.<Object>