-
Notifications
You must be signed in to change notification settings - Fork 9
Popup Component
This component exists to delete existing entities in a animated way (appearing as a popup). The only requirement to using the popup component is that it is on an entity with a RenderTextureComponent, or an inheritor.
The popup component can be added to any entity at runtime, after which the entity will slide upwards and fade in opacity for a specified duration, and then once fully faded out be deleted (and disposed of) from the game.
The popup component has two arguments: duration: the amount of time (ms) until the speed: the speed at which the popup moves upwards
The popup uses timers to ensure that its motion is independant of framerate (it will move exactly duration*speed distance before being disposed of), so you can guarantee the bounds in which the popup will move fairly easily. This does not however guarantee disposal time, which occurs when next possible after the entity has faded out in order to prevent issues.
This factory produces new popup entities, rather than removing existing entities from the game. This is designed for use with the resource extractors specifically, as it takes a resource as an argument, however it can be used anywhere.
Simply supply a resource, and you will be given a new popup entity with resource icons, which will fade out and up in 1 second.
An example of the start and (near) end state of a popup with 1 second duration and speed 0.001:
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files