Drones have vision and hearing.
Drone sight has a distance and an angle, implemented by ray cast.
Using a state machine to switch between behaviors of AI drones:
- Idle (initial state)
- Patrol - Pick a random patrol location and auto-path to it
- Look Around - Stay put and look around
- Alert - Transition state to Chase, when the player can be seen. Duration - 1s
- Investigate - Go to where the player is last seen at
- Chase - Chase the player
- Deactivated - Shut down & Fall to the ground
- Stunned - Power down for a few seconds and resume to Look Around. Duration - 5s
- Player
- Tag - Player
- Map plane
- Navigation Static
- Walls
- Navigation Static
- Drone
- Tag - Drone
*And, bake the Nav Mesh.
-
Unity User Manual
https://docs.unity3d.com/2022.1/Documentation/Manual/UnityManual.html
-
State Machine
-
AI Sight
-
Field of View Effect
-
Chase