protected virtual void OnGameStateChanged(object sender, GameStateEventArgs e) { var handler = GameStateChanged; if (handler != null) { handler(this, e); } }
/// <summary> /// Raises the game state changed event. This is the main entry point for all /// game state event changes. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">The event arguments.</param> /// <remarks> /// This handles all game state changes, so you can just use one function to /// call all the events. /// /// This method will then call more specific event invocators, so that objects /// dependent on those specific events can listen to those, and don't have /// to check whether they have to do something themselves. /// </remarks> public void RaiseGameStateChanged (object sender, GameStateEventArgs e) { // General Game state event. OnGameStateChanged (sender, e); // Call more specific events var handler = gameStateEvents [e.NewState]; if (handler != null) handler (sender, e); }
/// <summary> /// Raises the game state changed event. This is the main entry point for all /// game state event changes. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">The event arguments.</param> /// <remarks> /// This handles all game state changes, so you can just use one function to /// call all the events. /// /// This method will then call more specific event invocators, so that objects /// dependent on those specific events can listen to those, and don't have /// to check whether they have to do something themselves. /// </remarks> public void RaiseGameStateChanged(object sender, GameStateEventArgs e) { // General Game state event. OnGameStateChanged(sender, e); // Call more specific events var handler = gameStateEvents [e.NewState]; if (handler != null) { handler(sender, e); } }
void GameEventsBroadcaster_Instance_PauseGame(object sender, GameStateEventArgs e) { Debug.Log("[Test] This is shown when the PauseEnter event has been fired."); }
void GameEventsBroadcaster_Instance_PauseGame1(object sender, GameStateEventArgs e) { Debug.Log("[Test] Oh hai. Calling from the second handler."); }
void Counter(object sender, GameStateEventArgs e) { }
void Fail(object sender, GameStateEventArgs e) { Assert.Fail("Handler has been called although it shouldnt."); }
void Pass(object sender, GameStateEventArgs e) { Assert.Pass("Handler Pass 1 has been executed."); }
protected virtual void OnGameStateChanged (object sender, GameStateEventArgs e) { var handler = GameStateChanged; if (handler != null) handler (this, e); }
void GameEventsBroadcaster_Instance_PauseGame (object sender, GameStateEventArgs e) { Debug.Log ("[Test] This is shown when the PauseEnter event has been fired."); }
void GameEventsBroadcaster_Instance_PauseGame1 (object sender, GameStateEventArgs e) { Debug.Log ("[Test] Oh hai. Calling from the second handler."); }
void Counter (object sender, GameStateEventArgs e) { }
void Fail (object sender, GameStateEventArgs e) { Assert.Fail ("Handler has been called although it shouldnt."); }
void Pass (object sender, GameStateEventArgs e) { Assert.Pass ("Handler Pass 1 has been executed."); }