Skip to main content

Overview

TilePlus Messaging and Events

TpLib has general-purpose messaging and Event functionality. Messages get sent to tiles, and tiles can post events.

Messages functionality uses the TpMessaging Service and Events functionality uses the TpEvents static class.

The use of Messages and Events facilitates event-driven design with TilePlus tiles. As your game proceeds you send Messages to tiles; usually from a Monobehaviour or other code which is responding to user input. Tiles post Events in response.

Messages are sent immediately. Events are stored and evaluated later.

A simple example: a game where there's a player character moving around. Your code messages all tiles interested in knowing where the player is located. If one of the messaged tiles decides that the player is at that tile's position or nearby it "posts" an Event. Your controlling program gets a callback announcing that an Event had been posted. At some point, perhaps during Update, you call a method in TpEvents to process the events.