Skip to main content

ToolBasedEffectBase

An abstract class in Root.Township, the global namespace.

Base for pooled skill visuals that copy an object's meshes (skipping docks) and animate a _Progress material over them, such as ToolBasedEffect and DissipateToolBasedEffect. Client side.

Constructors​

MemberWhat it is
protected ToolBasedEffectBase()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected readonly int _ProgressShader property ID for _Progress.
protected Material materialCopy of the base material used by every mesh effect.
protected Coroutine meshAnimationThe running animation coroutine.
6 private and internal fields
MemberWhat it is
private Material baseMaterialMaterial copied for the effect meshes.
private static readonly List<MeshRenderer> effectCacheShared static list reused while gathering renderers.
private static readonly List<MeshRenderer> filterCacheShared static list returned by GetRenderersWithoutDocks.
private PooledObjectDefinition meshEffectDefinitionPooled mesh effect spawned on each renderer, copying its mesh.
private readonly List<MeshEffect> meshEffectsMesh effects spawned for the current target; released by CleanEffects.
private static readonly Stack<Transform> transformStackShared static stack used to walk the hierarchy.

Methods​

MemberWhat it is
void InitializeEffect(Component component)Spawns a mesh effect copy for each enabled mesh renderer (from a component's children, skipping docks, or a given list) and plays the in animation.
void InitializeEffect(IEnumerable<MeshRenderer> renderers)Spawns a mesh effect copy for each enabled mesh renderer (from a component's children, skipping docks, or a given list) and plays the in animation.
override void Release()Plays the out animation instead of releasing straight away.
protected abstract IEnumerator Animate(bool isIn)Coroutine for the in or out animation. Subclasses drive _Progress here.
protected void CleanEffects()Clears and releases every mesh effect copy.
2 private and internal methods
MemberWhat it is
private void Awake()Makes this effect's own copy of baseMaterial.
private static List<MeshRenderer> GetRenderersWithoutDocks(Transform root)Collects mesh renderers under a transform, skipping any branch that has a PickupDock (so docked items are left out). Uses a shared static list.

Used in​

Members of other types that take, return or hold a ToolBasedEffectBase: