How to do it...

Let's set everything up first:

  1. First, create a new Animator Controller using the Create button in the Project window, as shown in the following screenshot:
  1. Next, create a new default state called Wandering.
  2. Then, create a new state called Pursuing.
  3. Next, connect both states to each other, and back, with two transitions, as you'll see in the following screenshot:
  1. Now, we create two trigger parameters: Pursue and Wander, as shown in the following screenshot:
  1. Next, assign the Wander parameter to the set of conditions in ...

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.