RegionConsumptionUI

Overview

Star-bar showing local demand (outline halves) versus current supply (filled halves). Overflow supply halves are tinted by the selected personality color (Mobster/Schemer/Subterfuge). An optional prediction mode pulses the halves that would change if an event response is applied.

Serialized

  • Sprites leftStarUnfilled, leftStarFilled, rightStarUnfilled, rightStarFilled
  • IntVariable selectedPersonality; ColorConstant mobsterColor, schemerColor, subterfugeColor
  • (Optional Prediction) FloatEvent predictionEvent, bool isPredictor, pulseEffectTime, pulseEffectMin

Baseline Painting

UpdateUI() computes halves:

  • supply = floor(SupplyPerTick * 2)
  • demand = floor(LocalDemand * 2)
    For each half from left to right:
  • i <= supplyfilled; color = personality color when i > demand (overflow), else white.
  • supply < i <= demandunfilled outline.
  • i > demand → hidden.

Prediction Mode

When isPredictor and a non-zero delta arrives via predictionEvent:

  • Repaints the baseline, then pulses:
    • The gain/loss region between current and predicted demand (only where visible).
    • Any supply halves whose overflow status would change.
  • Pulsing is an alpha-only SmoothStep Ping-Pong between 1.0 and pulseEffectMin over pulseEffectTime.

Cleans up by unregistering the event and restoring alphas on destroy.