A class in Root.Township, the global namespace.
Pooled effect (a DestroyByTime) that, when taken from the pool, line-casts for ground and shows a child particle at the hit point, facing along the surface normal.
Constructors
| Member | What it is |
|---|
CastToSurfaceEffect() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Vector3 castDirection | Direction of the cast. Default down. |
private float castDistance | Length of the cast, centred on the effect's position. |
private LayerMask groundLayers | Layers the cast can hit. |
private GameObject groundParticle | Child object shown at the ground hit point. |
private bool isCasting | Set at bake time when groundParticle is set. Nothing happens at runtime when false. |
Methods
| Member | What it is |
|---|
protected override void Awake() | If baking found a ground particle, hides it and hooks the pool request and release events. |
3 private and internal methods
| Member | What it is |
|---|
private void CastToGround(PooledObject pooledObject) | On pool request: casts along castDirection and, on a hit, moves and shows the ground particle there. |
private void IBuildRendererPostBake.PostBake() | Build bake step: sets isCasting to whether a ground particle is assigned. |
private void StoreCasted(PooledObject pooledObject) | On pool release: hides the ground particle. |