Enemies with sight, hearing and a state machine, made in Unity (URP) with NavMesh. The arena has cover, a doorway and patrol routes.
Note: Logic build mein AI ki help li gayi hai.
| Key | Action |
|---|---|
| W A S D | Move |
| Shift | Run (loud) |
| C | Crouch (quiet) |
| Space | Jump |
| Left mouse button | Shoot (very loud) |
| R | Reload (or try again after dying) |
| T | Restart the arena |
Patrol -> Suspicious (?) -> Investigate -> back to Patrol
Patrol -> sees the player long enough -> Chase -> Attack
Chase -> loses the player -> Search -> back to Patrol
- Sight: a view cone with a line of sight check. It needs a moment to be sure (awareness grows faster when you are close). Very close, it notices you even from behind.
- Hearing: running, walking and shots make noise (
Noise). Walls make the noise quieter. Enemies walk to the place they heard it. - Allies: an enemy that spots you or gets shot alerts the enemies near it.
- Two kinds: a melee grunt (wind-up before the hit, so you can step away) and a shooter that fires from a distance with some spread.
- Headshots do more damage. Every enemy shows its state and health above its head.
- Select an enemy in the Scene view to see its view cone.
- Unity 6000.3.25f1 (Universal 3D / URP).
- Open
Assets/Scenes/SampleScene.unityand press Play.