Data and Event Handling - Breakdown


Data and Event Handling

I tried a new approach to pass references of events and variables between many scripts to achieve as much cross-compatibility and decoupling as possible. I achieved this using an interface, generics, and the Observer Pattern.

(IEventAndDataHandler.cs)

A parent script will implement the IEventAndDataHandler interface to allow other scripts to interact with it. This parent script acts as the subject and all the scripts that reference the interface are the observers.

(C_Move.cs)

I designed this interface to be useful in many different use cases and perhaps I will use this in future projects to limit coupling and encourage scalability.

Get Magisteros

Leave a comment

Log in with itch.io to leave a comment.