Moving away from the AI related branches for Week 6 I decided to work on the pickups to get the base mechanic set up for future use. This needed to be done as modularly as possible since there will be a number of things that the player can pick up, all with different effects. I also decided to start implementing UI elements following the same reasoning, since the player will need that information fed to them in the least complex way. 
The UI element that pops up when a player looks at anything that can be interacted with has a few different functions built into it; one that determines the input device and button image to display, one that determines the item name to display and one that picks what prompt to display. 
Using a BPI and a local function on the parent pickup, and parent class of anything that can be interacted with allows for the child classes to write-on their individual logic easily. After being picked up and the child logic running the last function that displays a bit of text reminding the player of what they just did, which will be more useful for things that get added to the player's inventory. The overall system for knowing when the player is looking at something to prompt an interaction is a line-trace that runs on every tick when the player is within a certain distance of an interactable. The line-trace is run directly from the center of the camera so it has the highest odds of being where the player is looking. 

You may also like

Back to Top