Skip to content
Update 1. Introduction authored by Jake Carfagno's avatar Jake Carfagno
......@@ -6,6 +6,10 @@ EventTriggers, EventConditions, and EventActions comprise a system for setting u
Everything within the system is an **EventTrigger**, an **EventCondition**, or an **EventAction**. Think of them as conditions and effects: an EventTrigger specifies when to do something, the EventActions specify what to do when that something happens, and an EventCondition is an extra condition that has to be true when the something happens before the actions can be carried out. All are MonoBehaviours, meaning they can be attached to any GameObject within the Unity Scene.
Each of them extends from a common class **ModularEventComponent**. They share one common field within the Inspector:
* **showDebug:** This boolean indicates whether the component should print Debug Log-level messages into the console. It is `false` by default to prevent clutter in the logs. You can access this field in child components using the read-only property `ShowDebug` so custom logs within child classes also only print when needed.
## EventTriggers
An **EventTrigger** is a condition. While the Trigger is enabled, it will monitor for a specific event to occur. Some examples of EventTriggers with their respective conditions are:
......@@ -124,6 +128,10 @@ The EventTrigger, **TriggerInputKey**, activates during each Update() that the u
* **ActionTransformPositionSet** moves the target Transform, in this case the Player Transform, to the position where Pos Object (LeftPos Transform) is located. LeftPos is a GameObject child of the Player GameObject. As such, when the Player GameObject is moved, the LeftPos also moves to maintain its local position offset from the parent. This simple combination of TriggerInputKey and ActionTransformPositionSet gives the player the ability to move in one direction by holding down a key.
* **ActionCanvasTextSet** sets the text contents displayed by a Unity UI Canvas. The value to display can be hard-coded, but in the example here, the value is instead set using a pointer to another GameObject: the Controls_MoveLeft GameObject itself. The pointer's Target Field `name` indicates that, when this Action fires, the Canvas Text element will display the name of the Controls_MoveLeft GameObject. Within the example, this is used to show the player which GameObject is actively moving the player.
***Notes:***
* This screenshot was taken _before_ the **showDebug** field was added. As such, the field does not appear in the screenshot above.
# System Flow
![ModularEventsFlow](uploads/7cd04eec96ce33577168440555bcd3e0/ModularEventsFlow.png)
......
......