private int Step(float dt) { double num; int num1 = 0; int num2 = 0; HeadBob headBob = this; headBob.timeSolve = headBob.timeSolve + (double)dt; double num3 = ((double)this.cfg.solveRate >= 0 ? 1 / (double)this.cfg.solveRate : 1 / -(double)this.cfg.solveRate); if ((double)this.cfg.intermitRate != 0) { num = ((double)this.cfg.intermitRate >= 0 ? 1 / (double)this.cfg.intermitRate : 1 / -(double)this.cfg.intermitRate); } else { num = 0; } double num4 = num; if (double.IsInfinity(num3) || num3 == 0) { num3 = this.timeSolve; } bool flag = num4 > num3; double num5 = num3 * (double)this.cfg.timeScale; if (this.timeSolve >= num3) { do { HeadBob headBob1 = this; headBob1.timeSolve = headBob1.timeSolve - num3; if (flag) { HeadBob headBob2 = this; headBob2.timeIntermit = headBob2.timeIntermit - num3; if (this.timeIntermit < 0) { this.intermitStart = this.working; } } this.Solve(ref this.working, ref num5); if (flag && this.timeIntermit < 0) { this.intermitNext = this.working; this.intermitFraction = (this.timeIntermit + num3) / num3; HeadBob headBob3 = this; headBob3.timeIntermit = headBob3.timeIntermit + num4; num2++; } num1++; }while (this.timeSolve >= num3); } if (flag) { if (num2 > 0) { if (!this.simStep) { this.raw_pos = this.intermitNext.position.@value; this.raw_rot = this.intermitNext.rotation.@value; this.CheckDeadZone(); } else { Vector3G.Lerp(ref this.intermitStart.position.@value, ref this.intermitNext.position.@value, ref this.intermitFraction, out this.raw_pos); Vector3G.Lerp(ref this.intermitStart.rotation.@value, ref this.intermitNext.rotation.@value, ref this.intermitFraction, out this.raw_rot); this.CheckDeadZone(); } } return(num2); } if (!this.simStep) { this.raw_pos = this.working.position.@value; this.raw_rot = this.working.rotation.@value; this.CheckDeadZone(); } else { this.working.CopyTo(ref this.predicted); this.Solve(ref this.predicted, ref num5); num1 = -(num1 + 1); double num6 = this.timeSolve / num3; Vector3G.Lerp(ref this.working.position.@value, ref this.predicted.position.@value, ref num6, out this.raw_pos); Vector3G.Lerp(ref this.working.rotation.@value, ref this.predicted.rotation.@value, ref num6, out this.raw_rot); this.CheckDeadZone(); } return(num1); }
private int Step(float dt) { int num = 0; int num2 = 0; this.timeSolve += dt; double d = (this.cfg.solveRate >= 0.0) ? (1.0 / ((double)this.cfg.solveRate)) : (1.0 / -((double)this.cfg.solveRate)); double num4 = (this.cfg.intermitRate != 0.0) ? ((this.cfg.intermitRate >= 0.0) ? (1.0 / ((double)this.cfg.intermitRate)) : (1.0 / -((double)this.cfg.intermitRate))) : 0.0; if (double.IsInfinity(d) || (d == 0.0)) { d = this.timeSolve; } bool flag = num4 > d; double num5 = d * this.cfg.timeScale; if (this.timeSolve >= d) { do { this.timeSolve -= d; if (flag) { this.timeIntermit -= d; if (this.timeIntermit < 0.0) { this.intermitStart = this.working; } } this.Solve(ref this.working, ref num5); if (flag && (this.timeIntermit < 0.0)) { this.intermitNext = this.working; this.intermitFraction = (this.timeIntermit + d) / d; this.timeIntermit += num4; num2++; } num++; }while (this.timeSolve >= d); } if (flag) { if (num2 > 0) { if (this.simStep) { Vector3G.Lerp(ref this.intermitStart.position.value, ref this.intermitNext.position.value, ref this.intermitFraction, out this.raw_pos); Vector3G.Lerp(ref this.intermitStart.rotation.value, ref this.intermitNext.rotation.value, ref this.intermitFraction, out this.raw_rot); this.CheckDeadZone(); return(num2); } this.raw_pos = this.intermitNext.position.value; this.raw_rot = this.intermitNext.rotation.value; this.CheckDeadZone(); } return(num2); } if (this.simStep) { this.working.CopyTo(ref this.predicted); this.Solve(ref this.predicted, ref num5); num = -(num + 1); double t = this.timeSolve / d; Vector3G.Lerp(ref this.working.position.value, ref this.predicted.position.value, ref t, out this.raw_pos); Vector3G.Lerp(ref this.working.rotation.value, ref this.predicted.rotation.value, ref t, out this.raw_rot); this.CheckDeadZone(); return(num); } this.raw_pos = this.working.position.value; this.raw_rot = this.working.rotation.value; this.CheckDeadZone(); return(num); }
// Token: 0x06002E30 RID: 11824 RVA: 0x000AFA28 File Offset: 0x000ADC28 private int Step(float dt) { int num = 0; int num2 = 0; this.timeSolve += (double)dt; double num3 = ((double)this.cfg.solveRate >= 0.0) ? (1.0 / (double)this.cfg.solveRate) : (1.0 / -(double)this.cfg.solveRate); double num4 = ((double)this.cfg.intermitRate != 0.0) ? (((double)this.cfg.intermitRate >= 0.0) ? (1.0 / (double)this.cfg.intermitRate) : (1.0 / -(double)this.cfg.intermitRate)) : 0.0; if (double.IsInfinity(num3) || num3 == 0.0) { num3 = this.timeSolve; } bool flag = num4 > num3; double num5 = num3 * (double)this.cfg.timeScale; if (this.timeSolve >= num3) { do { this.timeSolve -= num3; if (flag) { this.timeIntermit -= num3; if (this.timeIntermit < 0.0) { this.intermitStart = this.working; } } this.Solve(ref this.working, ref num5); if (flag && this.timeIntermit < 0.0) { this.intermitNext = this.working; this.intermitFraction = (this.timeIntermit + num3) / num3; this.timeIntermit += num4; num2++; } num++; }while (this.timeSolve >= num3); } if (flag) { if (num2 > 0) { if (this.simStep) { Vector3G.Lerp(ref this.intermitStart.position.value, ref this.intermitNext.position.value, ref this.intermitFraction, ref this.raw_pos); Vector3G.Lerp(ref this.intermitStart.rotation.value, ref this.intermitNext.rotation.value, ref this.intermitFraction, ref this.raw_rot); this.CheckDeadZone(); } else { this.raw_pos = this.intermitNext.position.value; this.raw_rot = this.intermitNext.rotation.value; this.CheckDeadZone(); } } return(num2); } if (this.simStep) { this.working.CopyTo(ref this.predicted); this.Solve(ref this.predicted, ref num5); num = -(num + 1); double num6 = this.timeSolve / num3; Vector3G.Lerp(ref this.working.position.value, ref this.predicted.position.value, ref num6, ref this.raw_pos); Vector3G.Lerp(ref this.working.rotation.value, ref this.predicted.rotation.value, ref num6, ref this.raw_rot); this.CheckDeadZone(); } else { this.raw_pos = this.working.position.value; this.raw_rot = this.working.rotation.value; this.CheckDeadZone(); } return(num); }