public static void OnMinionPlayed(BaseMinion minionPlayed) { // If a tree falls in a forest without any one listening... if (!_minionPlayedListeners.Any()) return; // Listeners for this are called in the order in which they were played on the board var sortedListeners = _minionPlayedListeners.OrderBy(kvp => kvp.Item1.TimePlayed).ToList(); foreach (var handler in sortedListeners.Select(kvp => kvp.Item2)) { handler(minionPlayed); } }
/// <summary> /// Removes all deathrattles registered by the source card. /// </summary> /// <param name="source">The triggering card</param> public static void UnregisterDeathrattle(BaseMinion source) { GameEngine.Deathrattles.Remove(source); }
public static void OnMinionPlaced(BaseMinion minionPlaced) { if (!_minionPlacedListeners.Any()) return; // Listeners for this are called in the order in which they are played on the baord var sortedListeners = _minionPlacedListeners.OrderBy(kvp => kvp.Item1.TimePlayed).ToList(); foreach (var handler in sortedListeners.Select(kvp => kvp.Item2)) { handler(minionPlaced); } }