ChairmanSlider

Overview

A Slider that mirrors a FloatVariable and (optionally) supports prediction with a pulsing visual. Can color the fill using a Gradient based on the current value.

Serialized

  • FloatVariable sliderValue
  • bool useGradient and Gradient barGradient
  • Prediction (optional):
    • FloatEvent predictionEvent
    • bool isPredictorSlider
    • Color predictedPositiveColor, predictedNegativeColor
    • float pulseEffectTime, pulseEffectMin

Behavior

  • Start()
    • Cache Slider and fill Image, register sliderValue.Changed → OnValueChanged.
    • If predictionEvent:
      • Register OnPredictedValueChanged.
      • If isPredictorSlider, start PulseEffect() coroutine for alpha pulsing.
    • Initialize with OnValueChanged(sliderValue.Value).
  • OnValueChanged(value) → set slider.value = value; if useGradient, update fill color from barGradient.
  • OnPredictedValueChanged(change)
    • If isPredictorSlider: temporarily extend the visible value toward 1 and set color to positive/negative.
    • Else: temporarily show a reduced value toward 0.
  • OnDestroy() → unregisters events and stops coroutines if any.