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
-
ObjectScriptableObjectTowerAsset
- 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
TowerAsset()
public TowerAsset()
Fields
abilities
Abilities the player can buy on this tier (usually the final branches).
public List<AbilityData> abilities
Field Value
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
cost
Gold paid to build this tier, or to upgrade into it.
[Min(0)]
public int cost
Field Value
description
Short description shown in menus.
[TextArea]
public string description
Field Value
formationRadius
Radius of the idle formation around the rally point.
[Min(0)]
public float formationRadius
Field Value
rallyRadius
Maximum distance from the tower to its rally point (range ellipse).
[Min(0)]
public float rallyRadius
Field Value
rangedAttacks
Ranged attack channels.
public List<RangedAttackData> rangedAttacks
Field Value
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
respawnTime
Seconds before a fallen soldier is replaced.
[Min(0)]
public float respawnTime
Field Value
soldier
Soldier produced by this tower; null disables the barracks role.
[Header("Barracks (optional)")]
public SoldierAsset soldier
Field Value
soldierCount
Number of living soldiers maintained.
[Min(0)]
public int soldierCount
Field Value
targetPriority
Default target ordering for this tier's attacks.
public TargetPriority targetPriority
Field Value
upgrades
Immediate upgrade targets. Two or more entries form a branch.
public List<TowerAsset> upgrades
Field Value
Properties
DisplayRange
The largest attack range, or the rally radius for pure barracks.
public float DisplayRange { get; }
Property Value
IsBarracks
Whether this tier produces soldiers.
public bool IsBarracks { 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>