public GameBoard(int Width, int Height, System.Windows.Forms.PictureBox PictureGameBoard) { _picGameBoard = PictureGameBoard; _pellets = new Pellets(); _pellets.OnPelletEaten += new Pellets.onPowerPelletEatenEventHandler(PelletEaten); _pathPoints = new ArrayList(); //_sndBackground = new GameSound(_picGameBoard); //_sndEffect = new GameSound(_picGameBoard); _levels = CreateLevels(); _player1 = new Player(BoardPlayer.Player1); _player1.CurrentLevel = NextLevel(); _player2 = new Player(BoardPlayer.Player2); _player2.CurrentLevel = NextLevel(); _currentPlayer = _player1; }
private void PelletEaten(object source, Pellets.PelletEventArgs e) { switch (e.PelletType) { case PelletType.RegularPellet: PlayBoardSound(BoardSounds.PelletEat); //PlayEatSound(); _currentPlayer.Score += 10; UpdateScore(); break; case PelletType.PowerPellet: _powerMode = true; if (OnPowerMode != null) OnPowerMode(this, new EventArgs()); PlayBoardSound(BoardSounds.PelletEat); //PlayEatSound(); _currentPlayer.Score += 50; UpdateScore(); break; } if (_pellets.RegularPelletCount == 0 && _pellets.PowerPelletCount == 0) { if (OnBoardCleared != null) OnBoardCleared(this, new EventArgs()); } }