ModyEvent is a specialized event that can trigger a UnityEvent and a set of ModyActionRunners. It is the core of the Mody system, designed to trigger one or more ModyActionRunners.
ModyEventBase is the base class for all ModyEvents. It provides a list of ModyActionRunners that trigger set actions on referenced modules. ModyEvent, on the other hand, inherits from ModyEventBase and adds a UnityEvent that gets invoked when the event is executed. Note that if a ModyEvent is not enabled, the UnityEvent will not get invoked.
ModyEvent provides several methods to check for the presence of runners or events. For example, the
hasRunnersproperty returns true if there are runners attached to the event, and the
hasEventsproperty returns true if the event has persistent event listeners set in the Inspector.
To execute a ModyEvent, simply call its
Execute()method. This will trigger all attached runners and invoke the UnityEvent, if present.
Note that ModyEvent is fully customizable, and you can create your own events by inheriting from ModyEventBase and adding your own functionality. You can also create your own ModyActionRunners to extend the system’s capabilities as needed.