PlayerStatistics should stop ticking after lost/win
This commit is contained in:
@@ -45,10 +45,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Queue<int> EarnedSamples = new Queue<int>(100);
|
public List<int> EarnedSamples = new List<int>(100);
|
||||||
int earnedAtBeginningOfMinute;
|
int earnedAtBeginningOfMinute;
|
||||||
|
|
||||||
public Queue<int> ArmySamples = new Queue<int>(100);
|
public List<int> ArmySamples = new List<int>(100);
|
||||||
|
|
||||||
public int KillsCost;
|
public int KillsCost;
|
||||||
public int DeathsCost;
|
public int DeathsCost;
|
||||||
@@ -73,22 +73,22 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void UpdateEarnedThisMinute()
|
void UpdateEarnedThisMinute()
|
||||||
{
|
{
|
||||||
EarnedSamples.Enqueue(EarnedThisMinute);
|
EarnedSamples.Add(EarnedThisMinute);
|
||||||
earnedAtBeginningOfMinute = resources != null ? resources.Earned : 0;
|
earnedAtBeginningOfMinute = resources != null ? resources.Earned : 0;
|
||||||
if (EarnedSamples.Count > 100)
|
|
||||||
EarnedSamples.Dequeue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateArmyThisMinute()
|
void UpdateArmyThisMinute()
|
||||||
{
|
{
|
||||||
ArmySamples.Enqueue(ArmyValue);
|
ArmySamples.Add(ArmyValue);
|
||||||
if (ArmySamples.Count > 100)
|
|
||||||
ArmySamples.Dequeue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (self.Owner.WinState != WinState.Undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
|
|
||||||
var timestep = self.World.IsReplay ? replayTimestep : self.World.Timestep;
|
var timestep = self.World.IsReplay ? replayTimestep : self.World.Timestep;
|
||||||
|
|
||||||
if (ticks * timestep >= 60000)
|
if (ticks * timestep >= 60000)
|
||||||
|
|||||||
Reference in New Issue
Block a user