domingo, 3 de abril de 2016

BP Compendium: Event Dispatcher

Event Dispatcher

"Event Dispatcher" allows a type of communication between Class Blueprints and Level Blueprint. It is created in a Blueprint class and can be implemented in the Level Blueprint.

Example Usage

Imagine that we are creating a blueprint "BP Button" to represent a button that can be pressed. The purpose of this blueprint is just to inform when the button is pressed. In this way we can use this button for several different situations. The actions that will occur when the button is pressed will be set at the Level Blueprint.

In the "MyBlueprint" tab of the "BP_Button", create an EventDispatcher named "Button Pressed":

When the "Enter" key is pressed, the event dispatcher "Button Pressed" will be called:

Add a "BP Button" to the level and select it. Open the Level Blueprint and right click in the EventGraph to add the event "Button Pressed" related to the EventDispatcher that was created.

Assuming there is a blueprint called "Rocket" in the level and that it has a function called "Starts Rocket Launch". The Level Blueprint is responsible for calling the "Starts Rocket Launch" function when the button is pressed.

Click to enlarge