Class LevelView
- Namespace
- TDMaker.Unity.View
- Assembly
- TDMaker.Unity.dll
Draws level geometry for samples and prototypes: a generated ground texture (grass, roads that follow the lanes, rocks, tufts and trees), path entry/exit markers and stone build pads. Everything is procedural and deterministic.
[AddComponentMenu("2D Tower Defense Maker/Level View")]
public sealed class LevelView : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourLevelView
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.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
LevelView()
public LevelView()
Properties
GroundArt
Painted ground sprite (null = generated ground).
public Sprite GroundArt { get; }
Property Value
- Sprite
GroundArtCenter
World position of the painted ground sprite's pivot.
public Vector2 GroundArtCenter { get; }
Property Value
- Vector2
GroundArtRect
World rectangle covered by the painted ground art (empty when none), pixels-per-unit aware.
public Rect GroundArtRect { get; }
Property Value
- Rect
LevelBounds
World bounds of paths and build slots (no margin), valid after the level is built.
public Rect LevelBounds { get; }
Property Value
- Rect
PathPadding
Extra road width around the outer lanes used when drawing roads (editor tools draw the same band).
public float PathPadding { get; }
Property Value
Methods
ComputeBounds(LevelDef)
Bounds of a level's lanes and build slots.
public static Rect ComputeBounds(LevelDef level)
Parameters
levelLevelDef
Returns
- Rect
Configure(SimulationRunner, EntityViewRegistry)
Assigns the runner and registry; call before enabling.
public void Configure(SimulationRunner source, EntityViewRegistry views)
Parameters
sourceSimulationRunnerviewsEntityViewRegistry
Connect()
Subscribes to the runner and builds the current level. Called from OnEnable; tools may call it in edit mode.
public void Connect()
SetGroundArt(Sprite, Vector2)
Uses a painted map texture instead of the generated ground; its pivot is placed at center.
public void SetGroundArt(Sprite sprite, Vector2 center)
Parameters
spriteSpritecenterVector2