Power - spotřebovává se když jsou zavřené dveře. Hráči mohou zavírat pouze dveře na svojí polovině mapy. Oprava bugu v MovementOpportunity, který způsoboval zpožďování intervalu.

This commit is contained in:
Perry 2026-03-12 22:33:35 +01:00
parent 7656707177
commit 25a62af483
22 changed files with 240 additions and 59 deletions

View file

@ -12,7 +12,7 @@ public class MovementOpportunity {
public bool ConstantChance{ get; private set; }
private Stopwatch stopwatch = new();
private int stopwatchOffset = 0;
private long stopwatchOffset = 0;
private Random random = new();
@ -37,9 +37,10 @@ public class MovementOpportunity {
}
public bool Check() {
if (stopwatch.ElapsedMilliseconds + stopwatchOffset >= Interval){
stopwatchOffset = (int)(stopwatch.ElapsedMilliseconds - Interval);
stopwatch.Restart();
if (stopwatch.ElapsedMilliseconds - stopwatchOffset >= Interval){
int overshoot = (int)(stopwatch.ElapsedMilliseconds - stopwatchOffset - Interval);
stopwatchOffset = stopwatch.ElapsedMilliseconds - overshoot;
// stopwatch.Restart();
return true;
}
return false;