예제 #1
0
 //Create a function to fire event
 public void RaiseEvent(GameboardEventArgs e)
 {
     if (GameboardEvent != null)
     {
         GameboardEvent(this, e);
     }
 }
예제 #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);
     }
 }
예제 #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));
 }
예제 #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));
     }
 }