A class in Root.Township, the global namespace.
Visual for an explosion's radius: it unparents itself while enabled, follows its original parent and scales a child to the radius, destroying itself if the parent is gone.
Constructors
| Member | What it is |
|---|
ExplosionRadius() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private Transform cachedParent | Original parent. |
private float explosionRadius | Radius to show. |
private float scaleMultiplier | Scale per unit of radius, to match the mesh size. |
private Transform scaler | Transform scaled to show the radius. |
Methods
5 private and internal methods
| Member | What it is |
|---|
private void Awake() | Remembers the original parent. |
private IEnumerator FixParent() (iterator) | A frame after disabling, reparents to the original parent or destroys itself if that is gone. |
private void LateUpdate() | Follows the parent's position and scales scaler to explosionRadius times scaleMultiplier. |
private void OnDisable() | Starts FixParent. |
private void OnEnable() | Unparents itself. |