Join Alan Thorn for an in-depth discussion in this video Chase and attack states, part of Cert Prep: Unity Particle Systems, AI, and Audio.
- [Instructor] In the final movie of this chapter,…I want to take a look at the two remaining states…for the NPC AI.…Specifically these states are the chase state,…this state happens when the NPC finally sights the player…and starts to chase after them,…and then we have the attack state.…This state happens when the NPC…gets near enough to the player character to attack them,…and then they will continue to attack them…for as long as the attacked state is active.…
Let's start by taking a look at the chase state,…which you can see open here inside MonoDevelop.…The chase state is a coroutine,…and the way that we can get to this state…is from the idle state.…In the idle state, the NPC is wandering around,…and if they see the player, it changes to the chase state.…Now, when the chase state is active here,…we enter this while loop.…That is, we continually loop around in the chase state,…and the first thing that we do…on every iteration of that loop…is we set the destination of the NPC character…to the player position.…
This course is part of our Unity cert prep series, focusing on exam objectives related to particle systems, artificial intelligence (AI), navigation and pathfinding systems, and audio. Instructor Alan Thorn teaches you how to control particle emitters, including particle life and size. He explains how to use navigation meshes to control obstacle avoidance, create compelling NPCs by setting up and triggering animation states, and add music and sounds effects to your 2D and 3D games.
Find out more about Unity Certified Developer exam at https://certification.unity.com/.
- Shaping and controlling particle emitters
- Adjusting particle life and size
- Moving objects
- Working with navigation meshes
- Starting and completing idle states
- Starting chase and attack states
- Adding music and 2D and 3D sound