Creating additional states

At this stage, we have created an interesting, yet simple, artificial behavior, whereby the enemies present in the maze will, if they see the character, or are within a specific radius, walk toward the player and alert all other enemies in this area. We will now include an additional state that we will call Attack, which will be triggered when these enemies are within reach of the player:

  1. Locate the prefab Zombie@attack by navigating to Assets | chapter5| chapter5_pack.
  2. Click once on this prefab, and in the Inspector window, click on the Rig tab.
  3. In the new window, select the option Humanoid for the attribute Animation Type and click on Apply.
  4. Click on the Animations tab, and then click on the label attack, this will provide ...

Get Getting Started with Unity now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.