domingo, 3 de abril de 2016

BP Compendium: Delay

Delay


Delay is a latent function that performs the actions connected to the pin "Completed" only after the time specified in the parameter "Duration" has elapsed. The latent functions do not follow the normal flow of execution of the Blueprints. They run in parallel and can take several ticks until its completion.

Input

  • Duration: Time in seconds the Delay function must wait.

Output

  • Completed: Execution pin that will be activated after the time of "Duration" has elapsed.


Example Usage

Suppose in a game that there are several factors that can lead to the spawn of an enemy. The custom event "SpawnEnemy" was created with a delay function to ensure that it has elapsed at least 5 seconds before creating a new enemy. Even if the "Spawn Enemy" event is called again in less than 5 seconds, the delay function does not allow the creation of a new enemy.

The image below shows that the event "Spawn Enemy" is running and also shows that there is still "2.244" seconds for the creation of a new enemy.

Click to enlarge

In another example there is a custom event "Game Over" which displays a game over screen and after 3 seconds changes the value of a variable that keeps the game state so that the game return to the menu.

Click to enlarge