public void AddScore(int playerId, int amount) { _playerPoints[playerId] += amount; if (_playerPoints[playerId] > MaxScore) { _playerPoints[playerId] = MaxScore; } if (_playerPoints[playerId] < -MaxScore) { _playerPoints[playerId] = -MaxScore; } Sound.PlaySound(amount > 0 ? SoundType.ScorePositive : SoundType.ScoreNegative); _messagePump.Publish(new ScoreUpdatedMessage()); if (_playerPoints[playerId] != 0) { return; } _playerRounds[playerId]++; if (_playerRounds[playerId] >= MaxRounds) { GameWon(playerId); } else { RoundWon(playerId); } }