When conveying information to the player, we decided that this would be through a textbox Popup on the Player's wrist. For handiness, we duplicated the textbox class that was used for the Pause Menu, and removed the ticks.
To have this menu function, I had three bindings on the cost menu, what the "Text" should be, what the "Cost" is and the Player's current score, all casting from the Widget to the Player through a bind.
Then, when I wanted a buyable object to have it's price displayed, I first had a trigger box check if the player had entered the box. Then, I cast to the player, and call the function, Toggle Textbox.
The toggle textbox function is modified so it only ever spawns one textbox, and doesn't keep spawning textboxes. This is through a branch making it so the Textbox count never being allowed to exceed the number 1. Then, I call the new Menu Class that calls the Textbox.
Then, to have the text display, I have the binding of "WeaponCost" be determined by the Integer present in the Blueprint that's linked to the Cost of the weapon, and the "CostText" be a Text Variable along the lines of "Purchase This For".
Then, I call "Close Textbox", which just calls the Close Menu function.
Finally, it displays when the player is near the buyable item, along with the text.
Comentarios