Placement - is a simple trigger with background, delay and progress bar. You can use this as a trigger to open shop panels, upgrades and other actions.
Canvas Group - link to canvas group required for UI Element.
Use Delay - enables a delay to send an event that the player has entered the trigger.
Delay Time - number of seconds.
Use Progress Bar - enables the progress bar that shows the delay time.
Progress Bar - link to progress bar.
Reset On Exit - resets progress bar value to 0.
OnEnterPlacement(GameObject) - event that is called after the player has entered the trigger and the delay time has passed if it is enabled. Transfers a link to the game object entered in the trigger.
OnExitPlacement(GameObject) - event that is called after the player leaves the trigger. Transfers a link to the game object leaves the trigger.
NOTICE: Placement is used in conjunction with Trigger, so you can limit to game objects what tags the trigger will work with. The placement script is inherited from UIElement so you can easily hide it and show it without turning off the game object itself.
QUESTIONS: 1. How do I subscribe to Placement events? - Get a convenient way you link and subscribe to events.
[SerializeField] private Placement _placement;
private void Start()
{
_placement.OnEnterPlacement.AddListener(OnEnterPlacement);
_placement.OnExitPlacement.AddListener(OnExitPlacement);
}
private void OnEnterPlacement(GameObject go)
{
//Do something...
Debug.Log($"{go.name} entered placement.");
}
private void OnExitPlacement(GameObject go)
{
//Do something...
Debug.Log($"{go.name} left placement.");
}