Skip to content

Commit

Permalink
Merge pull request #62 from Nytra/linkaTesting3
Browse files Browse the repository at this point in the history
Some adjustments to startTime
  • Loading branch information
Xlinka authored Dec 13, 2024
2 parents 01e160f + 885cb20 commit 56a8781
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions ProjectObsidian/ProtoFlux/Flow/Time/Local Stopwatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ protected override void ComputeOutputs(FrooxEngineContext context)
// Update elapsed time if running
if (_isRunning)
{
if (_startTime >= 0) // Only update if startTime is initialized
{
_elapsedTime += currentTime - _startTime;
}
_elapsedTime += currentTime - _startTime;
_startTime = currentTime;
}

Expand All @@ -62,10 +59,7 @@ protected override void ComputeOutputs(FrooxEngineContext context)
private IOperation DoStart(FrooxEngineContext context)
{
_isRunning = true;
if (_startTime < 0)
{
_startTime = context.World.Time.WorldTime;
}
_startTime = context.World.Time.WorldTime;
return OnStart.Target;
}

Expand All @@ -78,7 +72,7 @@ private IOperation DoStop(FrooxEngineContext context)
private IOperation DoReset(FrooxEngineContext context)
{
_elapsedTime = 0.0;
_startTime = -1.0;
_startTime = context.World.Time.WorldTime;
return OnReset.Target;
}
}
Expand Down

0 comments on commit 56a8781

Please sign in to comment.