A downloadable game

AI shooting with a navigation mesh involves an enemy patrolling between two points. When the player is in range, the enemy starts shooting and chases the player. If the player goes out of range, the enemy returns to patrolling.

Concepts Used:

NavMeshAgent: Used to handle pathfinding and movement of the enemy AI using Unity's navigation mesh system (enemyagent).

Waypoints: The enemy patrols between defined waypoints (walkpoints) using methods like Vector3.Distance and Vector3.MoveTowards.

Spherical Detection: Uses Physics.CheckSphere to determine if the player is within the enemy's vision or shooting radius (playerinvisionradius, playerinshootingradius).

Raycasting: Used to simulate shooting and detect if the player's body is hit (Physics.Raycast).

Animator: Controls different animations (anim.SetBool) based on the enemy's state.

Health System: Manages the enemy's health, damage taken, and death (enemyhitdmg, enemydie).

Audio: Plays shooting sound effects using AudioSource and AudioClip (audioSource.PlayOneShot).

Particle Effects: Uses a ParticleSystem to show muzzle flash when shooting (muzzlespark.Play).

Invoke: Used to manage shooting cooldowns and delay actions (Invoke(nameof(activeshooting), timebtwshoot)).

Leave a comment

Log in with itch.io to leave a comment.