Skip to content

Unity3D Framework for Event Management & State transitions

Latest

Choose a tag to compare

@menondj menondj released this 15 Jan 03:03

Contains base classes for Event/Actions & State Machines using design patterns

This respository contains useful classes written in C# for Event Driven programming as well as state machine execution. Here we use a comination of publisher observer design patterns and delegates to efficiently create state machines and actions on the fly.

StateMachine.cs : Base class for state machine. This is a Scriptable Object. Subsequent state machines are dervived from this class.

EventPublisher.cs: A Singleton Base class (ScriptableObject) which forms the foundation for all publisher-observer patterns. If an event occurs in a gameObject, others can register, get notified and perform actions within their script. Any script which has access to this singleton can Notify, Register, UnRegister for events.

Usage: Using the above classes in a script is illustrated in SampleStateMachine.cs & Sample.cs. The latter is attached to a gameObject and creates and instance of SampleStateMachine