Browse Source

отчистка координат

Виктор 4 years ago
parent
commit
5d49b358af
1 changed files with 8 additions and 8 deletions
  1. 8 8
      Assets/Scripts/Controllers/PlayerController.cs

+ 8 - 8
Assets/Scripts/Controllers/PlayerController.cs

@@ -350,7 +350,7 @@ public class PlayerController : MonoBehaviour
         int i = 0;
         float step = 0.1f;
         if (moving.ContainsKey(m.acc_id))
-        {           
+        {
             if (moving[m.acc_id].index < Workers[m.acc_id].Count) i = moving[m.acc_id].index;
             if (moving[m.acc_id].step < 1.1f) step = moving[m.acc_id].step;
         }
@@ -371,27 +371,27 @@ public class PlayerController : MonoBehaviour
             var progress = "";
             if (active_mode == Mode.History) progress = $"\n{i + 1} из {Workers[m.acc_id].Count}";
             //if (starting) 
-                Position(step, start_pos, end_pos, m, w, progress);
+            Position(step, start_pos, end_pos, m, w, progress);
             // StartingAccPositiong(m.value, time_step);
 
         }
 
-        if (step >= 1)
+        step += interpolationPeriod; // 0.1f;        
+        moving[m.acc_id].step = step;
+        if (step > 1)
         {
             i++;
+            moving[m.acc_id].index = i;
         }
-        step += interpolationPeriod; // 0.1f;
-        moving[m.acc_id].index = i;
-        moving[m.acc_id].step = step;
 
         if (active_mode == Mode.RealTime)
-            if (moving[m.acc_id].step >= 1)
+            if (step > 1)
             {
                 Workers.Remove(m.acc_id);
                 Debug.LogWarning($"clear coord user {m.acc_id}");
             }
         if (active_mode == Mode.History)
-            if (moving[m.acc_id].index == Workers[m.acc_id].Count)
+            if (i == Workers[m.acc_id].Count)
             {
                 //StopProgress();
                 Workers.Remove(m.acc_id);