blendingstarttime: use .localtime (faster)

This commit is contained in:
mischa 2024-04-04 19:17:37 +08:00
parent 9b92113648
commit d656239476

View File

@ -160,7 +160,7 @@ protected void BeginBlending()
{ {
state = ForecastState.BLENDING; state = ForecastState.BLENDING;
// if (debugColors) rend.material.color = blendingAheadColor; set in update depending on ahead/behind // if (debugColors) rend.material.color = blendingAheadColor; set in update depending on ahead/behind
blendingStartTime = NetworkTime.time; blendingStartTime = NetworkTime.localTime;
OnBeginBlending(); OnBeginBlending();
// Debug.Log($"{name} BEGIN BLENDING"); // Debug.Log($"{name} BEGIN BLENDING");
} }
@ -268,7 +268,7 @@ void FixedUpdateClient()
// sample the blending curve to find out how much to blend right now // sample the blending curve to find out how much to blend right now
float blendingElapsed = (float)(NetworkTime.time - blendingStartTime); float blendingElapsed = (float)(NetworkTime.localTime - blendingStartTime);
float relativeElapsed = blendingElapsed / blendingTime; float relativeElapsed = blendingElapsed / blendingTime;
float p = blendingCurve.Evaluate(relativeElapsed); float p = blendingCurve.Evaluate(relativeElapsed);
// Debug.Log($"{name} BLENDING @ {blendingElapsed:F2} / {blendingTime:F2} => {(p*100):F0}%"); // Debug.Log($"{name} BLENDING @ {blendingElapsed:F2} / {blendingTime:F2} => {(p*100):F0}%");