Exemplo n.º 1
0
 //Create a function to fire event
 public void RaiseEvent(GameboardEventArgs e)
 {
     if (GameboardEvent != null)
     {
         GameboardEvent(this, e);
     }
 }
Exemplo n.º 2
0
 //Create a function to raise/fire gameboard event
 public void RaiseEvent(GameboardEventArgs e)
 {
     //Only execute if there are event listener listing to events
     if (GameEventHandler != null)
     {
         GameEventHandler(this, e);
     }
 }
Exemplo n.º 3
0
 //Override the On Click Mine Event Handler, Do not call the base.OnCollectObject();
 public override void OnCollectObject(object sender, GameboardEventArgs e)
 {
     //Check event type
     if (e.GameboardEvent != GAME_EVENT.COLLECT_OBJECT)
     {
         return;
     }
     //Show all the mine
     board.ShowAllMine();
     //Fire gameover event
     board.RaiseEvent(new GameboardEventArgs(GAME_EVENT.GAMEOVER));
 }
Exemplo n.º 4
0
 //On CollectObject/ ClickMine Event Handler, only multiplayer game mode use it
 public virtual void OnCollectObject(Object sender, GameboardEventArgs e)
 {
     //Check event type
     if (e.GameboardEvent != GAME_EVENT.COLLECT_OBJECT)
     {
         return;
     }
     //Add score to the current player
     gameBoard.Players[gameBoard.Turn].Score++;
     //Update the score label
     gameBoard.TopBannerHUD.UpdateScore(gameBoard.Turn, gameBoard.Players[gameBoard.Turn].Score);
     //Flag the mine
     SetTileImage("F");
     //If player has found more than half of the mines, gameover
     if (gameBoard.Players[gameBoard.Turn].Score > gameBoard.Mine / 2)
     {
         gameBoard.RaiseEvent(new GameboardEventArgs(GAME_EVENT.GAMEOVER));
     }
 }