Introduction

00:00:00:11 - 00:00:28:11

Peter

In this section, we are going to add the stamina system to our A-game so that every use of our tool will use up energy that the player has and we are going to force the player to either eat something or go to sleep when we deplete all our energy. We are going to introduce some modifications to existing classes, which is never a great solution, but we are going to have a problem with the stamina system which will which will be separate system.


00:00:28:23 - 00:00:54:19

Peter

The aging stamina will rely on the agent data since it contains all the information about the agent. So again, as will adhere to the variable called stamina. So let's make it yellow as well. We are going to adhere to the stamina parameter and our agent stamina will work based on those values in the agent data. Now this is all great and we are going to have the stamina that will display our stamina value.


00:00:54:27 - 00:01:15:01

Peter

But now there is a problem of actually being able to make use of the stamina and to actually check if we have enough of it or not. We could use the data inside the age in the data, but with we then we would have to handling all of the scripts it wants to use it to check if we are not getting below zero or if we have enough stamina.


00:01:15:15 - 00:01:34:24

Peter

So we need to kind of fuze this agent stamina clause to modify this stamina value. This way we will need to add it to our age in the definition because each agent in our game can have the stamina for example, we might have a health bar that will help move our field and it will also need to know its stamina.


00:01:35:01 - 00:02:00:09

Peter

That's why we are going to expand it, to extend the agent and the player with this age and stamina property. And this is one problem because if some other script implements this agent, it will break. So this is not a great solution, but we need to introduce that because now we have the different interactions. Well, each tool can be using the stamina.


00:02:00:18 - 00:02:23:28

Peter

Our hand still has the specific interactions like the snippy interaction, toolbox, interaction, or anything else that we can only do using our hands tool. And there is the problem. We need to introduce the check in the tools back. If this is not a hand tool, check that we can perform the action against the stamina value. And that's why we are going to have to change the tools back.


00:02:24:13 - 00:02:43:15

Peter

But if we are using the handle, things like pick up interaction, it will need to be blocked because the can still by default will not check against the stamina and it will not make use of it. So actually the water interaction and feel water interaction will not be changed because this code will be handled by the tools back.


00:02:44:02 - 00:03:06:09

Peter

But the pick up interaction will need to know about the stamina of the agent. So that's why we need to add it as a parameter to our agent and to the player so that the pickup interaction can have a reference to the agent stamina and can check against it. And so that's the tools back. It will also get the reference from the agent.


00:03:06:21 - 00:03:28:27

Peter

So obviously we could give those to the reference to our agent stamina, but since we are passing those the agent parameter, we are also going to be able to access it this way. So I chose to modify this agent and the player definitions and this is why we are going to introduce those modifications as soon as we are sure that no one is yet using this agent.


00:03:28:29 - 00:03:48:09

Peter

A definition. This is just an introduction of a new requirements to our project that our code doesn't handle. And the only way to introduce it is by adding it to our agent. But again, this is something that is you can think about, but for now we are just going to proceed with implementing this system by introducing those changes.


00:03:48:23 - 00:03:50:20

Peter

Okay, let's go to our project.


Complete and Continue