Unity Game Development AI Behavior & Navigation
Class overview Class 2 Revision Canvas UI Enums – Enemy States NavMesh Baking NavMesh Agent Setting Enemy Patrols Range & Radius Checking Damage to Player Damage to Zombies
Revision Parenting objects in Hierarchy 2D Movement 3D Movement Character Rotation to Mouse Position Prefabs (Bullets, Ammo Crates) Shooting & Spawning Bullets Canvas UI Targets! Applying Textures to Materials Advanced: Weapon Equipment Advanced: New Weapons
Canvas UI Use Canvas System to add UI elements on screen Display Health & Bullet Ammo in Text
Enums – Enemy States Idle Patrol Chase Attack
NavMesh baking Window AI Navigation Make objects Static in order to bake NavMesh
NavMesh Agent Setup Steering Settings Set Destination in code Stop / Resume NavMeshAgent
Setting Enemy Patrols Save Origin Swap between Target and Origin as NavMeshAgent Destination Advanced: use a list of multiple Targets for an advanced patrol setup
Range & Radius Checking In “Idle” and “Patrol” states Search for the Player every Update. Visualize distance with Debug Gizmos For now we use a Radius (Sphere) to detect the player
Damage To Player Do a distance check (melee hit) Add an attack cooldown Apply Damage and Reduce Health Play sound Reset Cooldown If too far away Chase player again
Damage To Zombies OnTriggerEnter check for “Bullet” tag Destroy the Bullet Play sound Reduce Health Destroy Zombie if Health below zero
Q&A Do you have any questions related to the topics mentioned?