Introduction

00:00:00:15 - 00:00:24:15

Peter

In this section, we're going to add a hot bar to our game so that we can select the item and carry it over our head with the purpose of either consuming it or throwing it away. Code wise, we are going to add two new classes and we will have to modify our player script. Since this logic will be specific to our player, although we could extend it for every agent.


00:00:24:29 - 00:00:43:18

Peter

Basically we are going to add a lot of our class that will direct how the hot bar looks and how it works. This will be basically the visual part of our system. It will be connecting to the item database as to the item controller UI so that we can show the items in our hot bar. Enter the item selection outline.


00:00:43:28 - 00:01:09:17

Peter

This script was responsible for creating an outline around this selected item in our inventory and we can reuse it for our hot bar. Now. Next, we're going to create a Carry manager which will actually be responsible for triggering the carry item animation and actually selecting the items we want to carry and storing its index so that we can later use the item or remove it from our inventory.


00:01:09:27 - 00:01:36:17

Peter

This will still have the reference to the item database, but now the player script that we will modify, we'll have will need to connect to the health bar to update the hold bar based on our inventory and to connect to the carry manager so that we can ask current manager who actually selected the item and updated the hold bar selection using the outline, and also to later get the feedback about what happens to the item.


00:01:36:27 - 00:01:57:01

Peter

Now again, this will be a specific system for our player but also could be extended for our agents. The point is that when we press our action key now we will need to check if we are carrying an item and if we should consume it and throw it away before we actually use the item. So we are going to introduce a couple of modifications to the existing player's code.


00:01:57:10 - 00:02:11:14

Peter

This isn't always great because we can break something easily, but most changes will be added rather than modifications to the existing code. So this is not that bad. Okay, let's go to our project and start creating our new system.


Complete and Continue