Esempio n. 1
0
 private void AggregateAllDataIfNecessary()
 {
     if (aggregatedResult == null)
     {
         aggregatedResult = PlayerCounter.Sum(this.counters.AllEntries, playerCount);
     }
 }
Esempio n. 2
0
        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);
        }