コード例 #1
0
ファイル: GameEngine.cs プロジェクト: mraycheva/console-game
 /*
  * Raises the event "DefenceEnd", if an subscription for it exists.
  */
 private void Hero_DefenceEnd(object sender, DefenceEndArgs e)
 {
     if (DefenceEnd != null)
     {
         new EventHandler <DefenceEndArgs>(DefenceEnd)
             (this, e);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: mraycheva/console-game
 /*
  * When the "DefenceEnd" event is being raised,
  * prints in the console the health points of the hero who was attacked.
  */
 private static void GameEngine_DefenceEnd(object sender, DefenceEndArgs e)
 {
     Console.WriteLine(e.Defender.Nickname + "'s health points: " + e.Defender.HealthPoints + ".");
 }