Class PathAuthoring
- Namespace
- TDMaker.Unity.Authoring
- Assembly
- TDMaker.Unity.dll
Scene authoring for an enemy path. Points are in local space; sub-lanes are generated from the center line using laneCount and laneSpacing. In curve mode (curve) the user edits a few controlPoints and points is regenerated as a smooth curve sampled every curveNodeSpacing units (see RebuildFromCurve()).
[AddComponentMenu("2D Tower Defense Maker/Path Authoring")]
public sealed class PathAuthoring : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourPathAuthoring
- 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
PathAuthoring()
public PathAuthoring()
Fields
airRoute
Presentation only: drawn as a dashed flight line instead of a road (routes for flying units).
[Tooltip("Presentation only: drawn as a dashed flight line instead of a road (routes for flying units).")]
public bool airRoute
Field Value
controlLaneSpacing
Optional per-control lane spacing (curve mode), interpolated along the curve; non-positive uses laneSpacing.
public List<float> controlLaneSpacing
Field Value
controlPoints
Curve control points in local space, from entry to exit (curve mode only).
public List<Vector2> controlPoints
Field Value
- List<Vector2>
curve
Curve mode: points is generated from controlPoints as a smooth curve. Off = plain polyline.
[Header("Curve")]
[Tooltip("Curve mode: the path is a smooth curve through the control points, sampled into nodes. Off = the points are used as they are.")]
public bool curve
Field Value
curveNodeSpacing
Distance between generated nodes along the curve.
[Tooltip("Distance between generated simulation nodes along the curve (world units).")]
[Min(0.05)]
public float curveNodeSpacing
Field Value
entryNode
Node at which enemies spawn.
[Min(0)]
public int entryNode
Field Value
exitNode
Node at which enemies leak; negative means the last node.
public int exitNode
Field Value
gizmoColor
Gizmo color.
public Color gizmoColor
Field Value
- Color
laneCount
Number of parallel sub-lanes.
[Min(1)]
public int laneCount
Field Value
laneSpacing
Distance between neighbouring sub-lanes.
[Min(0)]
public float laneSpacing
Field Value
overrideWaveCall
Place this entrance's wave-call button at waveCallOffset from the entry instead of the default spot.
[Header("Wave Call")]
[Tooltip("Place the wave-call button at Wave Call Offset from the entry instead of just ahead of it.")]
public bool overrideWaveCall
Field Value
pointLaneSpacing
Optional per-point lane spacing, index-aligned with points; missing or non-positive uses laneSpacing.
public List<float> pointLaneSpacing
Field Value
points
Center-line points in local space, from entry to exit. Generated from controlPoints in curve mode.
public List<Vector2> points
Field Value
- List<Vector2>
waveCallOffset
Wave-call button position relative to the entry node (world units).
public Vector2 waveCallOffset
Field Value
- Vector2
Properties
HasCurve
Whether curve mode is on and has enough control points to generate the path.
public bool HasCurve { get; }
Property Value
Methods
RebuildFromCurve()
Regenerates points and pointLaneSpacing from the control points (curve mode); the entry is the first node and the exit the last. Returns false (and changes nothing) when there are fewer than two control points.
public bool RebuildFromCurve()
Returns
ToPathData()
Creates path data with world-space points.
public PathData ToPathData()
Returns
ToWorld(Vector2)
Converts a local point to world space (XY plane).
public Vector2 ToWorld(Vector2 local)
Parameters
localVector2
Returns
- Vector2