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
armDelay
Delay before the trap can trigger (must be shorter than the lifetime).
[Min(0)]
public float armDelay
Field Value
cancelWithSource
Removes the trap when its source dies or disappears (off = the trap outlives its source).
public bool cancelWithSource
Field Value
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
id
Event key (also selects the marker colour in the view and counts toward the population limit).
public string id
Field Value
lifetime
Total lifetime in game seconds, including arming.
[Min(0.05)]
public float lifetime
Field Value
maxTriggers
Activations before the trap is used up.
[Min(1)]
public int maxTriggers
Field Value
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
placementRange
Search range for Opponent placement.
[Min(0)]
public float placementRange
Field Value
pointRule
Custom placement rule; rejected points cancel the activation.
public PointRuleData pointRule
Field Value
populationLimit
Maximum live traps with this id per source; zero is unlimited.
[Min(0)]
public int populationLimit
Field Value
targets
Extra trigger eligibility (area victims use normal damage eligibility).
public MechanicTargetData targets
Field Value
targetsEnemies
Triggered by enemies (otherwise by friendly soldiers and heroes).
public bool targetsEnemies
Field Value
targetsFlying
Flying units can trigger it.
public bool targetsFlying
Field Value
targetsGround
Ground units can trigger it.
public bool targetsGround
Field Value
triggerCooldown
Delay between activations (at most one per tick).
[Min(0)]
public float triggerCooldown
Field Value
triggerRadius
Detection radius (range ellipse), independent of the damage radius.
[Min(0)]
public float triggerRadius
Field Value
useCustomPointRule
Uses pointRule instead of the default rule (snap onto the nearest lane).
public bool useCustomPointRule
Field Value
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
Methods
ToDef()
Bakes the trap definition.
public TrapDef ToDef()