private void GamesManagerEventHandler(object sender, GameManagerEventArgs e) { switch (e.Level) // Which level raised the event { case DifficultyLevels.VeryEasy: // Very Easy level raised event GameCountVeryEasy = e.Count.ToString(); // Save the count to the Very Easy level property break; case DifficultyLevels.Easy: // Easy level raised the event GameCountEasy = e.Count.ToString(); // Save the count to the Easy level property break; case DifficultyLevels.Medium: // Medium level raised the event GameCountMedium = e.Count.ToString(); // Save the count to the Medium level property break; case DifficultyLevels.Hard: // Hard level raised the event GameCountHard = e.Count.ToString(); // Save the count to the Hard level property break; case DifficultyLevels.Expert: // Expert level raised the event GameCountExpert = e.Count.ToString(); // Save the count to the Expert level property break; } }
protected virtual void OnPlayerDown(GameManagerEventArgs e) { if (PlayerDown != null) { PlayerDown.Invoke(this, e); } }
private void RaiseEvent(GameManagerEventArgs e) { EventHandler <GameManagerEventArgs> handler = GamesManagerEvent; // Get a pointer to the event handler if (handler != null) // Any listeners? { handler(this, e); // Yes, then raise the event } }
protected virtual void RaiseEvent(Int32 count) { EventHandler <GameManagerEventArgs> handler = GameManagerEvent; if (handler != null) { GameManagerEventArgs e = new GameManagerEventArgs(_level, count); handler(this, e); } }
protected override void DyingAnimation(GameTime i_GameTime) { GameManagerEventArgs gameManagerEventArgs; if (getAnimationTime(i_GameTime) <= k_TimeToAnimate) { this.Dispose(); this.RotatingAnimation(this.CyclesPerSecond); this.FadeAnimation(i_GameTime, this.TimeToFade); } else { m_DidFinishDying = true; gameManagerEventArgs = new GameManagerEventArgs(); gameManagerEventArgs.PlayerType = this.PlayerType; OnPlayerDown(gameManagerEventArgs); OnRemoveMeAsNotifier(); } }
private void updatesGameManager_PlayerDown(object sender, GameManagerEventArgs e) { handleDeadPlayer(sender as IUpdateGameManager, e.PlayerType); }
private void GameManagerEventHandler(object sender, GameManagerEventArgs e) { RaiseEvent(e); }