itch.io is community of indie game creators and players

Devlogs

Data and Event Handling - Breakdown

Magisteros
A downloadable portfolio project for Windows

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.

Download Magisteros
Leave a comment