TraitNode
Overview
Represents a single trait on the slider. Stores the bound ChairmanTrait, exposes a select action, and implements a reveal-style alpha mask fill.
Serialized
- ChairmanTraitVariable
selectedtrait— target when selecting. - ChairmanTrait
traitData— backing data. - UI:
Transform mask,Transform fullAlphaBackground,Image fullAlphaIcon.
API
public void Init(ChairmanTrait trait);
public void SelectTrait(); // writes to selectedtrait.Value
public void SetAlphaMask(float t01); // 0..1 reveal with icon toggle at 1
Init
- Stores
traitData, writes backParentNode = this, and copies the node icon intotraitData.imgso other UIs can reuse it.
Alpha Mask
Shifts two transforms in opposite directions to simulate a horizontal wipe:
- Compute
sizeX = fullAlphaBackground.rect.widthanddelta = sizeX * t. mask.localPosition.x = -sizeX + deltafullAlphaBackground.localPosition.x = sizeX - deltafullAlphaIcon.enabled = (t >= 1)