I’m trying to implement a visibility meter for a 3rd person stealth game that increments over time while the player is visible to the AI, and once the meter is full the AI will chase the player. I’ve already implemented the AI’s behavior tree but I’m having an issue with how to increment a variable, over time, only while the AI can see the player.
The first switch statement handles the AI’s sight, and in my attempt at solving the problem I’ve run into an infinite loop. Also the second switch statement handles the AI’s hearing and won’t be needed for the visibility meter.