I'm working on making a simple game for a college assignment. The enemy is supposed to fire once every 2 seconds when the player is in its line of sight. However, once the player goes into the line of sight once, it keeps firing even when the conditions are no longer met. What do I need to do to fix this issue? Video showing the events and game footage below.