This commit is contained in:
Gurge44 committed 2026-02-18 19:50:26 +01:00
1 parent a67a5c58a1
commit f67eddd8ec
2 files changed
+32 -31

No files matched your search

+20 -23
View File
@@ -43,29 +43,28 @@ public class Counter(int totalGreenTime, int totalRedTime, char symbol, bool isR
public void Update()
{
if (Timer <= 0)
{
switch (IsRed, IsYellow)
{
// Change from green to yellow
case (IsRed: false, IsYellow: false):
IsYellow = true;
break;
// Change from red to green
case (IsRed: true, IsYellow: false):
TotalGreenTime = RandomGreenTime(Symbol);
IsRed = false;
break;
// Change from yellow to red
case (IsRed: false, IsYellow: true):
TotalRedTime = RandomRedTime(Symbol);
IsYellow = false;
IsRed = true;
break;
}
if (!Stopwatch.IsRunning || Timer > 0) return;
Stopwatch.Restart();
switch (IsRed, IsYellow)
{
// Change from green to yellow
case (IsRed: false, IsYellow: false):
IsYellow = true;
break;
// Change from red to green
case (IsRed: true, IsYellow: false):
TotalGreenTime = RandomGreenTime(Symbol);
IsRed = false;
break;
// Change from yellow to red
case (IsRed: false, IsYellow: true):
TotalRedTime = RandomRedTime(Symbol);
IsYellow = false;
IsRed = true;
break;
}
Stopwatch.Restart();
}
}
@@ -561,8 +560,6 @@ internal static class StopAndGo
}
End:
if (IsEventActive && Event.Type == Events.FrozenTimers) return;
data.UpdateCounters();
}
+12 -8
View File
@@ -1534,16 +1534,20 @@ internal static class ExtendedPlayerControl
public static Vector2 Pos(this PlayerControl pc)
{
if (pc.AmOwner) return pc.transform.position;
try
{
var queue = pc.NetTransform.incomingPosQueue;
var queue = pc.NetTransform.incomingPosQueue;
if (queue.Count > 0 && pc.NetTransform.isActiveAndEnabled && !pc.NetTransform.isPaused)
{
var array = queue._array;
int tail = queue._tail;
int index = (tail - 1 + array.Length) % array.Length; // handle wrap-around
return array[index];
if (queue.Count > 0 && pc.NetTransform.isActiveAndEnabled && !pc.NetTransform.isPaused)
{
var array = queue._array;
int tail = queue._tail;
int index = (tail - 1 + array.Length) % array.Length; // handle wrap-around
return array[index];
}
}
catch (Exception e) { ThrowException(e); }
return pc.transform.position;
}