// Processes statistics: public void ProcessObject() { // Processing current statisctics row: currentStatElement.ProcessObject(); // If it is done, moving to next: if ((currentStatElement.Done) && (currentStatElementIndex < (statElements.Count - 1))) { currentStatElement = statElements[++currentStatElementIndex]; } // If all done, then counting down lifetime if (statElements.Last().Done) { // if lifetime ended, calling OnEnd event: if ((--this.lifeTime < 1) && (OnEnd != null)) { OnEnd(this, new LevelEventArgs(this.gameStatus)); } } }
private void CreateStaisticsElements() { // Reading players statistics: for (int i = 0; i < this.players.Count(); i++) { this.playersHits[i] = this.players[i].GetEnemiesHit(); } // Adding statistics elements: switch (players.Count()) { case 1: { for (int i = 0; i < 4; i++) { statElements.Add(new StatElement(Ys[i], false, i + 1, playersHits[0][i])); } statElements.Add(new StatElement(Ys[4], true, 0, playersHits[0].Sum())); } break; case 2: { for (int i = 0; i < 4; i++) { statElements.Add(new StatElement(Ys[i], false, i + 1, playersHits[0][i], playersHits[1][i])); } statElements.Add(new StatElement(Ys[4], true, 0, playersHits[0].Sum(), playersHits[1].Sum())); } break; default: break; } // Setting current statistics element: currentStatElement = statElements[currentStatElementIndex]; }