In addition to the FSM for zombie behaviors, such as Idle, Chase, Attack, and Death, zombies respond to player input. Specifically, the player may attack by typing letters on the keyboard, matching the complete word above the zombie's head:
To achieve this, we must firstly display a word above the zombie's head, then keep track of the word being typed, and finally determine whether a match has been made. We already have some code to achieve much of this, but we should now link it specifically to the zombie character. Let's start by creating a text object that hovers above the zombie's head. Select the zombie NPC and expand its hierarchy in the Hierarchy panel. Select the Armature object and locate the head bone. This represents an empty game object used to move the character's head during animation...