I'm trying to create an AI for this project. Essentially I have a condition set: if A is true, we will randomly select a few different actions. If B is true, all actions in the prior condition should stop immediately with preference for B. Any actions in A's side will continue to run until finished however and I need an efficient way to end that.
While we're on the subject, is there maybe something I'm missing about programming games like this? I'm winging it here, but I wonder if there's some fundamental concepts I don't have.
In this example, every... frame, I guess... This condition on the bottom is tested. In all other cases, switchVar 1 or 2 will end up being called. If the bottom condition, kneeHealth <= 0 becomes true however, this does not result in the above actions being canceled. They occur concurrently. How do I stop that from happening?