Class HeroAsset

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

A player-controlled hero: base stats, growth rows (experience → level → skill points), skills and respawn. Add it to heroes; the runner spawns it at the level's hero spawn point.

[CreateAssetMenu(menuName = "2D Tower Defense Maker/Hero", fileName = "Hero", order = 13)]
public sealed class HeroAsset : EntityAssetBase
Inheritance
Object
ScriptableObject
HeroAsset
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Constructors

HeroAsset()

public HeroAsset()

Fields

companions

Owner-bound companions (ground escorts or flying followers) kept alive beside the hero.

[Header("Companions")]
[Tooltip("Owner-bound companions kept beside the hero: ground escorts follow its move orders, flying followers fly after it. Their damage earns the hero experience.")]
public CompanionData companions

Field Value

CompanionData

difficultyExperienceScale

Experience multiplier for difficulty.

[Min(0)]
public float difficultyExperienceScale

Field Value

float

engageRadius

Radius around its position in which an idle hero engages enemies.

[Min(0)]
public float engageRadius

Field Value

float

engagement

Where the hero stands beside the enemy it blocks (its share of the horizontal gap and a Y shift).

public EngagementGuestData engagement

Field Value

EngagementGuestData

experiencePerDamage

Experience gained per point of health the hero's attacks remove from enemies.

[Min(0)]
public float experiencePerDamage

Field Value

float

health

Base maximum health (level 1).

[Header("Vitals")]
[Min(1)]
public float health

Field Value

float

levels

Growth rows in level order; the first row is level 1 (experience 0).

public List<HeroLevelData> levels

Field Value

List<HeroLevelData>

magicalArmor

Base magical resistance in [0, 1].

[Range(0, 1)]
public float magicalArmor

Field Value

float

melee

Melee attack used while blocking.

[Header("Combat")]
public MeleeData melee

Field Value

MeleeData

movePointRule

Which destinations a move order accepts (shared with the click preview).

public PointRuleData movePointRule

Field Value

PointRuleData

physicalArmor

Base physical armor in [0, 1].

[Range(0, 1)]
public float physicalArmor

Field Value

float

rangedAttacks

Optional ranged attacks.

public List<RangedAttackData> rangedAttacks

Field Value

List<RangedAttackData>

recovery

Health recovery (usually idle only).

public RecoveryData recovery

Field Value

RecoveryData

respawnDelay

Seconds dead before returning.

[Header("Respawn & Movement")]
[Min(0)]
public float respawnDelay

Field Value

float

respawnPosition

Resurrection point when useRespawnPosition is set.

public Vector2 respawnPosition

Field Value

Vector2

returnDuration

Seconds of invulnerable return.

[Min(0)]
public float returnDuration

Field Value

float

skillMode

How skill ranks are gained.

[Header("Growth")]
public HeroSkillMode skillMode

Field Value

HeroSkillMode

skills

Skills; each rank has a required level and a point cost.

public List<AbilityData> skills

Field Value

List<AbilityData>

speed

Walking speed.

[Min(0)]
public float speed

Field Value

float

tags

Author-defined tag bits matched by effect and mechanic eligibility (Required/Rejected Tags).

public int tags

Field Value

int

useRespawnPosition

Returns at respawnPosition instead of where it fell.

public bool useRespawnPosition

Field Value

bool

Properties

LevelCount

Number of growth rows (at least one).

public int LevelCount { get; }

Property Value

int

Methods

BuildTemplate()

Builds the unresolved core template.

public override EntityTemplate BuildTemplate()

Returns

EntityTemplate

CollectProjectiles(List<ProjectileAsset>)

Adds projectile assets used by this asset's attacks.

public override void CollectProjectiles(List<ProjectileAsset> output)

Parameters

output List<ProjectileAsset>

CollectReferences(List<EntityAssetBase>)

Adds other entity assets this asset references (upgrades, soldiers).

public override void CollectReferences(List<EntityAssetBase> output)

Parameters

output List<EntityAssetBase>

ExperienceFor(int)

Cumulative experience needed for a one-based level.

public float ExperienceFor(int level)

Parameters

level int

Returns

float