Skip to main content

AvailablePointCrystal

A class in Root.Township, the global namespace.

Pooled client visual for an unspent progression point: fades in through a shader when taken from the pool and fades out before going back.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private static readonly int _ProgressShader property id for the fade amount.
private Coroutine animationCoroutineThe running fade, if any.
private float animationDurationSeconds a fade takes.
private Material animationMaterialInstance of animationMaterialBase made on first fade.
private Material animationMaterialBaseMaterial with the fade shader, copied for the animation.
private bool btnFadeInInspector test button for fading in.
private bool btnFadeOutInspector test button for fading out.
private Material fixedMaterialThe renderer's normal material, put back after each fade.
private Renderer targetRendererRenderer that fades.

Methods​

MemberWhat it is
override void Release()Fades out first; the real release happens when the fade ends.
4 private and internal methods
MemberWhat it is
private void Awake()Stores the normal material and fades in whenever the object is requested from the pool.
private void Fade(float target)Stops any running fade and starts one towards the target (0 shows it, 1 hides it).
private IEnumerator FadeCoroutine(float target) (iterator)Animates _Progress on a copy of the animation material, then restores the normal material; when fading out it releases to the pool.
private void FadeOnRequest(PooledObject pooledObject)Pool request handler: fades in.