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 back ParentNode = this, and copies the node icon into traitData.img so other UIs can reuse it.

Alpha Mask

Shifts two transforms in opposite directions to simulate a horizontal wipe:

  • Compute sizeX = fullAlphaBackground.rect.width and delta = sizeX * t.
  • mask.localPosition.x = -sizeX + delta
  • fullAlphaBackground.localPosition.x = sizeX - delta
  • fullAlphaIcon.enabled = (t >= 1)