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
useGradientand GradientbarGradient - Prediction (optional):
- FloatEvent
predictionEvent - bool
isPredictorSlider - Color
predictedPositiveColor,predictedNegativeColor - float
pulseEffectTime,pulseEffectMin
- FloatEvent
Behavior
- Start()
- Cache
Sliderand fillImage, registersliderValue.Changed → OnValueChanged. - If
predictionEvent:- Register
OnPredictedValueChanged. - If
isPredictorSlider, start PulseEffect() coroutine for alpha pulsing.
- Register
- Initialize with
OnValueChanged(sliderValue.Value).
- Cache
- OnValueChanged(value) → set
slider.value = value; ifuseGradient, update fill color frombarGradient. - OnPredictedValueChanged(change)
- If
isPredictorSlider: temporarily extend the visible value toward1and set color to positive/negative. - Else: temporarily show a reduced value toward
0.
- If
- OnDestroy() → unregisters events and stops coroutines if any.