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; ColorConstantmobsterColor,schemerColor,subterfugeColor - (Optional Prediction)
FloatEvent predictionEvent, boolisPredictor,pulseEffectTime,pulseEffectMin
Baseline Painting
UpdateUI() computes halves:
supply = floor(SupplyPerTick * 2)demand = floor(LocalDemand * 2)
For each half from left to right:i <= supply→ filled; color = personality color wheni > demand(overflow), else white.supply < i <= demand→ unfilled 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.0andpulseEffectMinoverpulseEffectTime.
Cleans up by unregistering the event and restoring alphas on destroy.