Class LevelAsset
- Namespace
- TDMaker.Unity.Authoring
- Assembly
- TDMaker.Unity.dll
A complete level: geometry, waves, economy and the towers the player may build. Call Bake() to produce a TemplateRegistry and LevelDef.
[CreateAssetMenu(menuName = "2D Tower Defense Maker/Level", fileName = "Level", order = 0)]
public sealed class LevelAsset : ScriptableObject, ISerializationCallbackReceiver
- Inheritance
-
ObjectScriptableObjectLevelAsset
- Implements
-
ISerializationCallbackReceiver
- 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
LevelAsset()
public LevelAsset()
Fields
availableTowers
Base towers buildable on empty slots. Their upgrade trees are included automatically.
public List<TowerAsset> availableTowers
Field Value
buildSlots
Construction slots.
public List<BuildSlotData> buildSlots
Field Value
cameraFraming
How the game camera frames this level (maps larger than the screen scroll). Presentation only.
[Header("Camera")]
public CameraFramingData cameraFraming
Field Value
extraTemplates
Additional templates to register (for example enemies spawned by scripts).
public List<EntityAssetBase> extraTemplates
Field Value
heroSpawn
Where heroes appear (further heroes are offset sideways).
public Vector2 heroSpawn
Field Value
- Vector2
heroes
Heroes spawned at the start of the level.
public List<HeroAsset> heroes
Field Value
music
Battle loop, intense loop and victory/defeat stingers of this level (played by a MusicPlayer). Presentation only.
[Header("Audio")]
public LevelMusicData music
Field Value
overrideRangeYScale
Whether rangeYScale overrides the runner's default.
public bool overrideRangeYScale
Field Value
paths
Enemy paths. Wave groups refer to them by index.
public List<PathData> paths
Field Value
rangeYScale
Range ellipse Y scale k: ranges cover dx²/r² + dy²/(k·r)² ≤ 1, so the vertical semi-axis is k·r.
Values below 1 flatten ranges vertically for an oblique top-down look (see RangeShape).
[Tooltip("Range ellipse Y scale k: vertical semi-axis = range × k. Below 1 flattens ranges (oblique view).")]
[Min(0.01)]
public float rangeYScale
Field Value
rules
Economy and flow rules (refunds, leak bounty, early-call rewards and spell cooldown cut).
[Header("Rules")]
public LevelRulesData rules
Field Value
spells
Player spells, in button order.
public List<SpellAsset> spells
Field Value
starRating
Legacy star rule (before the core rated victories). Migrated into rules.victoryRating when the asset loads;
edit victoryRating instead.
[HideInInspector]
public StarRatingData starRating
Field Value
startingGold
Starting gold.
[Min(0)]
public int startingGold
Field Value
startingLives
Starting lives.
[Min(1)]
public int startingLives
Field Value
waves
Wave schedule.
public WaveSetAsset waves
Field Value
Methods
Bake()
Bakes this asset's own geometry.
public BakedLevel Bake()
Returns
Bake(IReadOnlyList<PathData>, IReadOnlyList<BuildSlotData>, int?, IReadOnlyList<EntityAssetBase>, IReadOnlyList<ProjectileAsset>)
Bakes using externally supplied geometry (for example scene authoring components).
public BakedLevel Bake(IReadOnlyList<PathData> pathSource, IReadOnlyList<BuildSlotData> slotSource, int? startingGoldOverride = null, IReadOnlyList<EntityAssetBase> additionalTemplates = null, IReadOnlyList<ProjectileAsset> additionalProjectiles = null)
Parameters
pathSourceIReadOnlyList<PathData>Paths to bake.
slotSourceIReadOnlyList<BuildSlotData>Build slots to bake.
startingGoldOverrideint?Optional starting gold, for example for validation runs.
additionalTemplatesIReadOnlyList<EntityAssetBase>Optional further units to register (for example those a permanent upgrade swaps in).
additionalProjectilesIReadOnlyList<ProjectileAsset>Optional further projectiles the view should know (for example of upgrade mechanics).