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
-
ObjectScriptableObjectHeroAsset
- 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.nameObject.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
difficultyExperienceScale
Experience multiplier for difficulty.
[Min(0)]
public float difficultyExperienceScale
Field Value
engageRadius
Radius around its position in which an idle hero engages enemies.
[Min(0)]
public float engageRadius
Field Value
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
experiencePerDamage
Experience gained per point of health the hero's attacks remove from enemies.
[Min(0)]
public float experiencePerDamage
Field Value
health
Base maximum health (level 1).
[Header("Vitals")]
[Min(1)]
public float health
Field Value
levels
Growth rows in level order; the first row is level 1 (experience 0).
public List<HeroLevelData> levels
Field Value
magicalArmor
Base magical resistance in [0, 1].
[Range(0, 1)]
public float magicalArmor
Field Value
melee
Melee attack used while blocking.
[Header("Combat")]
public MeleeData melee
Field Value
movePointRule
Which destinations a move order accepts (shared with the click preview).
public PointRuleData movePointRule
Field Value
physicalArmor
Base physical armor in [0, 1].
[Range(0, 1)]
public float physicalArmor
Field Value
rangedAttacks
Optional ranged attacks.
public List<RangedAttackData> rangedAttacks
Field Value
recovery
Health recovery (usually idle only).
public RecoveryData recovery
Field Value
respawnDelay
Seconds dead before returning.
[Header("Respawn & Movement")]
[Min(0)]
public float respawnDelay
Field Value
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
skillMode
How skill ranks are gained.
[Header("Growth")]
public HeroSkillMode skillMode
Field Value
skills
Skills; each rank has a required level and a point cost.
public List<AbilityData> skills
Field Value
speed
Walking speed.
[Min(0)]
public float speed
Field Value
tags
Author-defined tag bits matched by effect and mechanic eligibility (Required/Rejected Tags).
public int tags
Field Value
useRespawnPosition
Returns at respawnPosition instead of where it fell.
public bool useRespawnPosition
Field Value
Properties
LevelCount
Number of growth rows (at least one).
public int LevelCount { get; }
Property Value
Methods
BuildTemplate()
Builds the unresolved core template.
public override EntityTemplate BuildTemplate()
Returns
CollectProjectiles(List<ProjectileAsset>)
Adds projectile assets used by this asset's attacks.
public override void CollectProjectiles(List<ProjectileAsset> output)
Parameters
outputList<ProjectileAsset>
CollectReferences(List<EntityAssetBase>)
Adds other entity assets this asset references (upgrades, soldiers).
public override void CollectReferences(List<EntityAssetBase> output)
Parameters
outputList<EntityAssetBase>
ExperienceFor(int)
Cumulative experience needed for a one-based level.
public float ExperienceFor(int level)
Parameters
levelint