コード例 #1
0
ファイル: Interpolation.cs プロジェクト: sknchan/LegacyRust
 public static void BindTiming(ulong delayMillis, double sendRateRatio, float sendRate)
 {
     Interpolation._sendRate = sendRate;
     Interpolation._ratio    = sendRateRatio;
     if (sendRate == 0f || sendRateRatio == 0 || sendRate < 0f != sendRateRatio < 0)
     {
         Interpolation._delayFromSendRateMillis = (ulong)0;
     }
     else
     {
         Interpolation._delayFromSendRateMillis = (ulong)Math.Ceiling(1000 * sendRateRatio / (double)sendRate);
     }
     Interpolation._delayMillis              = delayMillis;
     Interpolation._totalDelayMillis         = Interpolation._delayFromSendRateMillis + Interpolation._delayMillis;
     Interpolation._delaySeconds             = (double)((float)Interpolation._delayMillis) * 0.001;
     Interpolation._delayFromSendRateSeconds = (double)((float)Interpolation._delayFromSendRateMillis) * 0.001;
     Interpolation._totalDelaySeconds        = (double)((float)Interpolation._totalDelayMillis) * 0.001;
     Interpolation._deltaSeconds             = -Interpolation._totalDelaySeconds;
     Interpolation.@struct = Interpolation.Capture();
 }