private void AggregateAllDataIfNecessary() { if (aggregatedResult == null) { aggregatedResult = PlayerCounter.Sum(this.counters.AllEntries, playerCount); } }
static public PlayerCounter Sum(IEnumerable <PlayerCounter> counters, int playerCount) { var result = new PlayerCounter(playerCount); foreach (var counter in counters) { for (int playerIndex = 0; playerIndex < playerCount; ++playerIndex) { result.totalDivisor[playerIndex] += counter.totalDivisor[playerIndex]; result.totalCount[playerIndex] += counter.totalCount[playerIndex]; } } return(result); }