SDSMTGDT/Physicist — pull request #36 by chfeltman (2014-03-26 23:40:51+00:00)
Title: Addition of Physicist Events

This feature allows us to add well defined serializable events to the game. I've broken up any event into 2 separate pieces: Triggers and Modifiers.

Triggers are objects that have a specific activation condition, they are in essence the true 'event' in the typical sense of the word. In my example, I've created a ProximityTrigger class that has the ability to latch onto a Farseer Body and detect when other bodies are within the specified proximity. When this 'event' occurs, the trigger becomes active and sends out activation signals to specific modifiers.

Modifiers are objects that, when active, produce an effect. This could be anything ranging from modifying the very structure of the map, to incrementing a counter by 1. My example comes with two modifiers, one that applys a constant velocity to a Farseer Body and another that changes the sprite animation of an actor.

In order to obtain some modicum of control, triggers and modifiers are grouped together to form and 'event' this means that the only modifiers that triggers can be attached to are those that are found within the same event.

For references outside of the event, i.e. ProximityTrigger's attached target, or any modifier target, the event objects must go through a collection of interface members exposed by the Map object.