public trigger ( |
||
previousGameState | ||
currentGameState | ||
return | void |
private void triggerEvent(String eventName, AbstractEvent abstractEvent, GameStateData previousGameState, GameStateData currentGameState) { try { abstractEvent.trigger(previousGameState, currentGameState); } catch (Exception e) { if (faultingEventsCount.ContainsKey(eventName)) { faultingEventsCount[eventName]++; if (faultingEventsCount[eventName] > 5) { Console.WriteLine("Event " + eventName + " has failed > 5 times in this session"); } } if (!faultingEvents.ContainsKey(eventName)) { Console.WriteLine("Event " + eventName + " threw exception " + e.Message); Console.WriteLine("This is the first time this event has failed in this session"); faultingEvents.Add(eventName, e.Message); faultingEventsCount.Add(eventName, 1); } else if (faultingEvents[eventName] != e.Message) { Console.WriteLine("Event " + eventName + " threw a different exception: " + e.Message); faultingEvents[eventName] = e.Message; } } }