Class CompanionData

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

Owner-bound companion slots on a hero or tower, baked into a CompanionDef (template custom data). Each slot keeps one child alive: a ground escort (an ordinary soldier that blocks and follows the owner's move or rally orders) or a flying follower (keeps near the owner, never blocks, attacks from where it is). A fallen child is replaced after refillDelay, counted from its death. Child damage earns the owner experience.

public sealed class CompanionData
Inheritance
CompanionData
Inherited Members

Constructors

CompanionData()

public CompanionData()

Fields

acceleration

Flying followers: acceleration and braking in world units per second squared.

[Min(0.01)]
public float acceleration

Field Value

float

enabled

Whether the owner has companions.

public bool enabled

Field Value

bool

followStartDistance

Flying followers: distance at which a resting follower starts to fly after the owner.

[Tooltip("Flying followers: distance from the owner at which a resting follower starts to move (must exceed the stop distance).")]
[Min(0.01)]
public float followStartDistance

Field Value

float

followStopDistance

Flying followers: distance at which it stops again.

[Tooltip("Flying followers: distance from the owner at which it stops again.")]
[Min(0)]
public float followStopDistance

Field Value

float

formationRadius

Ground escorts: radius of their places around the owner's last move or rally point.

[Tooltip("Ground escorts: radius of their places around the owner's last move or rally point.")]
[Min(0)]
public float formationRadius

Field Value

float

initialDelay

Seconds after the owner appears before the first children.

[Tooltip("Seconds after the owner appears before the first children arrive.")]
[Min(0)]
public float initialDelay

Field Value

float

mode

Ground escort or flying follower.

[Tooltip("Ground Escort: walks, blocks and fights like a soldier. Flying Follower: flies after the owner, never blocks.")]
public CompanionMode mode

Field Value

CompanionMode

pointRule

Ground spawn and reposition validation; an invalid point leaves the slot empty.

public PointRuleData pointRule

Field Value

PointRuleData

rallyRadius

Towers without barracks: rally radius for moving ground escorts.

[Tooltip("Towers without barracks: how far the player may set the escorts' rally point. Barracks use their own rally radius.")]
[Min(0)]
public float rallyRadius

Field Value

float

reconnectOnReturn

Waiting children rejoin the owner when it returns (off = they leave).

[Tooltip("Waiting children rejoin the owner when it returns (off: they leave instead).")]
public bool reconnectOnReturn

Field Value

bool

refillDelay

Seconds after a child's death before its slot is refilled.

[Tooltip("Seconds after a child's death (or removal) before its slot is refilled.")]
[Min(0)]
public float refillDelay

Field Value

float

removeWithOwner

Children leave when the owner is sold or removed (off = they stay as independent units).

[Tooltip("Children leave when the owner is sold or removed (off: they stay on as independent units).")]
public bool removeWithOwner

Field Value

bool

slots

Children kept alive at once.

[Tooltip("Children kept alive at once (one per slot).")]
[Min(0)]
public int slots

Field Value

int

unit

The companion unit. Ground escorts need a non-flying soldier with melee; flying followers need a soldier with Flying on.

[Tooltip("The companion unit (a Soldier asset). Ground escorts: not flying, with a melee attack to block. Flying followers: Flying on, usually with a ranged attack.")]
public SoldierAsset unit

Field Value

SoldierAsset

useCustomPointRule

Uses pointRule for ground spawn and reposition points (default: on a lane).

public bool useCustomPointRule

Field Value

bool

waitOnOwnerDeath

While the owner is dead, children return to it and stop fighting.

[Tooltip("While the owner is dead, children return to it and stop fighting (off: they keep fighting on their own).")]
public bool waitOnOwnerDeath

Field Value

bool

Properties

IsValid

Whether the data bakes to companions.

public bool IsValid { get; }

Property Value

bool

Methods

ToDef()

Bakes the companion slots, or null when disabled or incomplete.

public CompanionDef ToDef()

Returns

CompanionDef