From 01e160f2d4b3cff47019dcc7f6f7037b17e1080b Mon Sep 17 00:00:00 2001 From: xLinka Date: Fri, 13 Dec 2024 20:55:40 +0000 Subject: [PATCH] Update Local Stopwatch.cs --- .../ProtoFlux/Flow/Time/Local Stopwatch.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ProjectObsidian/ProtoFlux/Flow/Time/Local Stopwatch.cs b/ProjectObsidian/ProtoFlux/Flow/Time/Local Stopwatch.cs index e7e31e6..b94d899 100644 --- a/ProjectObsidian/ProtoFlux/Flow/Time/Local Stopwatch.cs +++ b/ProjectObsidian/ProtoFlux/Flow/Time/Local Stopwatch.cs @@ -47,15 +47,11 @@ protected override void ComputeOutputs(FrooxEngineContext context) // Update elapsed time if running if (_isRunning) { - if (_startTime > 0) + if (_startTime >= 0) // Only update if startTime is initialized { _elapsedTime += currentTime - _startTime; } - _startTime = currentTime; - } - else - { - _startTime = -1.0; + _startTime = currentTime; } // Write outputs @@ -66,7 +62,7 @@ protected override void ComputeOutputs(FrooxEngineContext context) private IOperation DoStart(FrooxEngineContext context) { _isRunning = true; - if (_startTime < 0) + if (_startTime < 0) { _startTime = context.World.Time.WorldTime; } @@ -81,9 +77,8 @@ private IOperation DoStop(FrooxEngineContext context) private IOperation DoReset(FrooxEngineContext context) { - _isRunning = false; _elapsedTime = 0.0; - _startTime = -1.0; + _startTime = -1.0; return OnReset.Target; } }