Next up, we consider health and damage. Health is an interesting property, especially because it is abstract, that is, many characters have health: the player character and enemies, including the zombies. Though zombies are neither alive nor dead, but are undead, they still normally have an equivalent metric corresponding to health. When that property or resource is exhausted for any character, they expire, die, or are removed from the game. Due to the generic quality of health, it's a good idea to code it once so that it can be applied limitlessly as a component to any entity that has that property. For this reason, we'll create a Health class. Consider the following full source code and the comments that follow it:
//------------------------------------ using UnityEngine; using System.Collections; using UnityEngine.EventSystems; using UnityEngine...