concept health in category c#

appears as: health, health
Unity in Action: Multiplatform game development in C# with Unity 5

This is an excerpt from Manning's book Unity in Action: Multiplatform game development in C# with Unity 5.

The listing defines a field for the player’s health and reduces the health on command. In later chapters we’ll go over text displays to show information on the screen, but for now we can just display information about the player’s health using debug messages.

8.4.3. Restoring the player’s health by consuming health packs

Using items to restore the player’s health is another generally useful example. That requires two code changes: a new method in InventoryManager and a new button in the UI (see listings 8.22 and 8.23, respectively).

Listing 11.4. Adjusting PlayerCharacter to use health in PlayerManager