diff --git a/DroneSimulator/Drone.cs b/DroneSimulator/Drone.cs index b068f92..71e4224 100644 --- a/DroneSimulator/Drone.cs +++ b/DroneSimulator/Drone.cs @@ -40,7 +40,6 @@ namespace DroneSimulator public static bool TimeLimit = false; private Vector2 MoveOF = Vector2.Zero; - private uint CountOF = 0; private bool ReadyOF = false; public struct Physics @@ -366,8 +365,7 @@ namespace DroneSimulator lock (this) { - MoveOF += RealOF.result; - CountOF += 1; + MoveOF += RealOF.result * time; if (of) ReadyOF = true; } @@ -533,10 +531,11 @@ namespace DroneSimulator lock (this) { - if (ReadyOF && CountOF != 0) + if (ReadyOF) { - of.X = MoveOF.X / CountOF; - of.Y = MoveOF.Y / CountOF; + of.X = MoveOF.X; + of.Y = MoveOF.Y; + MoveOF = Vector2.Zero; } else { @@ -546,8 +545,6 @@ namespace DroneSimulator of.Time = RealOF.timer; - MoveOF = Vector2.Zero; - CountOF = 0; ReadyOF = false; } diff --git a/DroneSimulator/RealMode.cs b/DroneSimulator/RealMode.cs index d55daf8..79d8d1b 100644 --- a/DroneSimulator/RealMode.cs +++ b/DroneSimulator/RealMode.cs @@ -332,12 +332,11 @@ namespace DroneSimulator return true; } - v = laten[index]; + result = laten[index]; uint freq = 1000 / Freq; if (timer + freq <= time) { - result = v; timer = time; return true; }