Skip to main content

BoughtSkillCrystal

A class in Root.Township, the global namespace.

Client visual for a bought skill crystal: glows in its progression path's colour, can be dimmed, and cross-fades its emission when the path changes.

Constructors​

MemberWhat it is
BoughtSkillCrystal()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 _ColorShader property id for the colour.
private static readonly int _EmissionShader property id for the emission strength.
private Material activeMaterialMaterial instance used while lit.
private Coroutine animationThe running fade coroutine.
private Color inactiveColorSerialized colour for the inactive state. Not read in this class.
private Material inactiveMaterialThe renderer's original material, used while dimmed.
private float lerpDurationSeconds a fade takes.
private float litEmmisionEmission strength when fully lit.
private Renderer targetRendererRenderer of the crystal.

Properties​

MemberWhat it is
ProgressionPath CurrentPath { get; private set; }The progression path whose colour it shows.
bool IsDimmed { get; private set; }Whether the crystal is dimmed.

Methods​

MemberWhat it is
void Dim()Fades the glow out and switches to the inactive material.
void SetPath(ProgressionPath path)Shows the given path's colour, lighting up from dim or cross-fading from the old colour.
3 private and internal methods
MemberWhat it is
private void Awake()Keeps the original material as the inactive one and makes an instance for the lit state.
private IEnumerator FadeToCurrentPathColor() (iterator)Coroutine: fades the glow out, changes to the new path's colour, then fades it back in.
private IEnumerator LerpEmmision(int targetDirection) (iterator)Coroutine: fades emission towards 0 or litEmmision; switches to the inactive material when it ends dimmed.