Class TrapData

Namespace
TDMaker.Unity.Authoring
Assembly
TDMaker.Unity.dll

A fixed-position deployment (mine, snare, glyph) placed by an ability action, baked into TrapDef. It arms after a delay, then hits the nearest eligible unit inside its detection radius until its triggers or lifetime run out. Use it as an ability action (useTrap).

public sealed class TrapData
Inheritance
TrapData
Inherited Members

Constructors

TrapData()

public TrapData()

Fields

area

Optional region left at the trap on every trigger.

public AreaEffectData area

Field Value

AreaEffectData

armDelay

Delay before the trap can trigger (must be shorter than the lifetime).

[Min(0)]
public float armDelay

Field Value

float

cancelWithSource

Removes the trap when its source dies or disappears (off = the trap outlives its source).

public bool cancelWithSource

Field Value

bool

color

Marker, detection ring and trigger flash colour.

public Color color

Field Value

Color

damage

Hit on trigger: an area packet is centred on the trap, a single-target packet hits the triggering unit.

public DamageData damage

Field Value

DamageData

id

Event key (also selects the marker colour in the view and counts toward the population limit).

public string id

Field Value

string

lifetime

Total lifetime in game seconds, including arming.

[Min(0.05)]
public float lifetime

Field Value

float

maxTriggers

Activations before the trap is used up.

[Min(1)]
public int maxTriggers

Field Value

int

offset

World offset applied before point validation.

public Vector2 offset

Field Value

Vector2

placement

Where the ability puts the trap: source position, rally point, or the nearest eligible unit within placementRange.

public TrapPlacement placement

Field Value

TrapPlacement

placementRange

Search range for Opponent placement.

[Min(0)]
public float placementRange

Field Value

float

pointRule

Custom placement rule; rejected points cancel the activation.

public PointRuleData pointRule

Field Value

PointRuleData

populationLimit

Maximum live traps with this id per source; zero is unlimited.

[Min(0)]
public int populationLimit

Field Value

int

targets

Extra trigger eligibility (area victims use normal damage eligibility).

public MechanicTargetData targets

Field Value

MechanicTargetData

targetsEnemies

Triggered by enemies (otherwise by friendly soldiers and heroes).

public bool targetsEnemies

Field Value

bool

targetsFlying

Flying units can trigger it.

public bool targetsFlying

Field Value

bool

targetsGround

Ground units can trigger it.

public bool targetsGround

Field Value

bool

triggerCooldown

Delay between activations (at most one per tick).

[Min(0)]
public float triggerCooldown

Field Value

float

triggerRadius

Detection radius (range ellipse), independent of the damage radius.

[Min(0)]
public float triggerRadius

Field Value

float

useCustomPointRule

Uses pointRule instead of the default rule (snap onto the nearest lane).

public bool useCustomPointRule

Field Value

bool

vfx

Optional pooled VFX spawned on each trigger.

public GameObject vfx

Field Value

GameObject

Properties

Id

The resolved event key.

public string Id { get; }

Property Value

string

Methods

ToDef()

Bakes the trap definition.

public TrapDef ToDef()

Returns

TrapDef