Class TowerAsset

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

A buildable tower tier. Each tier is its own asset; upgrades lists the next tiers (more than one entry is a branch). A tower with a soldier acts as a barracks.

[CreateAssetMenu(menuName = "2D Tower Defense Maker/Tower", fileName = "Tower", order = 11)]
public sealed class TowerAsset : EntityAssetBase
Inheritance
Object
ScriptableObject
TowerAsset
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

TowerAsset()

public TowerAsset()

Fields

abilities

Abilities the player can buy on this tier (usually the final branches).

public List<AbilityData> abilities

Field Value

List<AbilityData>

companions

Owner-bound companions kept beside the tower (removed when it is sold, by default).

[Header("Companions (optional)")]
[Tooltip("Owner-bound companions kept beside the tower. Ground escorts use the barracks rally point (or their own rally radius); they leave when the tower is sold.")]
public CompanionData companions

Field Value

CompanionData

cost

Gold paid to build this tier, or to upgrade into it.

[Min(0)]
public int cost

Field Value

int

description

Short description shown in menus.

[TextArea]
public string description

Field Value

string

formationRadius

Radius of the idle formation around the rally point.

[Min(0)]
public float formationRadius

Field Value

float

rallyRadius

Maximum distance from the tower to its rally point (range ellipse).

[Min(0)]
public float rallyRadius

Field Value

float

rangedAttacks

Ranged attack channels.

public List<RangedAttackData> rangedAttacks

Field Value

List<RangedAttackData>

refundRatio

Legacy per-tower refund hint kept for data compatibility. It is not used for sales: the level's refundShare decides the refund, so the field is hidden in the Inspector.

[HideInInspector]
[Range(0, 1)]
public float refundRatio

Field Value

float

respawnTime

Seconds before a fallen soldier is replaced.

[Min(0)]
public float respawnTime

Field Value

float

soldier

Soldier produced by this tower; null disables the barracks role.

[Header("Barracks (optional)")]
public SoldierAsset soldier

Field Value

SoldierAsset

soldierCount

Number of living soldiers maintained.

[Min(0)]
public int soldierCount

Field Value

int

targetPriority

Default target ordering for this tier's attacks.

public TargetPriority targetPriority

Field Value

TargetPriority

upgrades

Immediate upgrade targets. Two or more entries form a branch.

public List<TowerAsset> upgrades

Field Value

List<TowerAsset>

Properties

DisplayRange

The largest attack range, or the rally radius for pure barracks.

public float DisplayRange { get; }

Property Value

float

IsBarracks

Whether this tier produces soldiers.

public bool IsBarracks { get; }

Property Value

bool

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>