Skip to content

Commit 32c0bf8

Browse files
committed
refactor: Renamed LagCompensationManager.simulationObjects to SimulationObjects
1 parent 0dae5b4 commit 32c0bf8

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

MLAPI/LagCompensation/LagCompensationManager.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using MLAPI.Exceptions;
45

56
namespace MLAPI.LagCompensation
@@ -12,7 +13,14 @@ public static class LagCompensationManager
1213
/// <summary>
1314
/// Simulation objects
1415
/// </summary>
15-
public static readonly List<TrackedObject> simulationObjects = new List<TrackedObject>();
16+
public static readonly List<TrackedObject> SimulationObjects = new List<TrackedObject>();
17+
/// <summary>
18+
/// Simulation objects
19+
/// </summary>
20+
[EditorBrowsable(EditorBrowsableState.Never)]
21+
[Obsolete("Use SimulationObjects instead", false)]
22+
public static List<TrackedObject> simulationObjects => SimulationObjects;
23+
1624

1725
/// <summary>
1826
/// Turns time back a given amount of seconds, invokes an action and turns it back
@@ -26,16 +34,16 @@ public static void Simulate(float secondsAgo, Action action)
2634
throw new NotServerException("Only the server can perform lag compensation");
2735
}
2836

29-
for (int i = 0; i < simulationObjects.Count; i++)
37+
for (int i = 0; i < SimulationObjects.Count; i++)
3038
{
31-
simulationObjects[i].ReverseTransform(secondsAgo);
39+
SimulationObjects[i].ReverseTransform(secondsAgo);
3240
}
3341

3442
action.Invoke();
3543

36-
for (int i = 0; i < simulationObjects.Count; i++)
44+
for (int i = 0; i < SimulationObjects.Count; i++)
3745
{
38-
simulationObjects[i].ResetStateTransform();
46+
SimulationObjects[i].ResetStateTransform();
3947
}
4048
}
4149

@@ -57,9 +65,9 @@ public static void Simulate(ulong clientId, Action action)
5765

5866
internal static void AddFrames()
5967
{
60-
for (int i = 0; i < simulationObjects.Count; i++)
68+
for (int i = 0; i < SimulationObjects.Count; i++)
6169
{
62-
simulationObjects[i].AddFrame();
70+
SimulationObjects[i].AddFrame();
6371
}
6472
}
6573
}

MLAPI/LagCompensation/TrackedObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ void Start()
9999
{
100100
Framekeys = new FixedQueue<float>(maxPoints);
101101
Framekeys.Enqueue(0);
102-
LagCompensationManager.simulationObjects.Add(this);
102+
LagCompensationManager.SimulationObjects.Add(this);
103103
}
104104

105105
void OnDestroy()
106106
{
107-
LagCompensationManager.simulationObjects.Remove(this);
107+
LagCompensationManager.SimulationObjects.Remove(this);
108108
}
109109

110110
internal void AddFrame()

0 commit comments

Comments
 (0)