Skip to content

Commit c175c9a

Browse files
committed
fix: Lamp fading code.
1 parent 37e94ad commit c175c9a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ private IEnumerator Blink(float blinkIntensity)
271271
private IEnumerator Fade(float value)
272272
{
273273
var counter = 0f;
274-
var duration = _value < 1
275-
? FadeSpeedUp * (1 - _value) / 1
276-
: FadeSpeedDown * (1 - (1 - _value) / 1);
274+
var duration = _value < value
275+
? FadeSpeedUp * (1 - _value)
276+
: FadeSpeedDown * _value;
277277

278278
if (duration == 0) {
279279
_value = value;
@@ -284,7 +284,7 @@ private IEnumerator Fade(float value)
284284
while (counter <= duration) {
285285
counter += Time.deltaTime;
286286
var position = counter / duration;
287-
var newValue = Mathf.Lerp(_value, 1, position);
287+
var newValue = Mathf.Lerp(_value, value, position);
288288
yield return SetIntensity(newValue);
289289
}
290290
}

0 commit comments

Comments
 (0)