Hey,
I've stumbled upon a small problem with my game.
I have 10 wasps that have some AI, just wandering around and whenever a wasp gets close to the queen wasp it starts chasing it. the queen just wanders around aswell. I can also move with my character and if I get close to either the wasps or the queen they will evade me. this all works fine however, I want to perform an action if ALL the wasps are chasing the queen. (I have an enum state for wander/chasing/evading) I made the array wasp in the game class and send them to my wasp class where all the code is in.
so my code for the wasps is:
wasps = new Wasp[10];
for (int i = 0; i < 10; i++)
{
wasps[i] = new Wasp(this, random, Wasp.kindofWasp.normal);
Components.Add(wasps[i]);
}
if (kind == kindofWasp.normal)
{
//code for the small wasps
}
if (kind == kindofWasp.queen)
{
//code for the queen wasp
}
but if I use: if (state == State.chasing) it will function even if its only 1 wasp chasing the queen.
so to make a long story short, how do I make an if statement that checks if all of the wasp meet a certain condition?
Sorry for the long explaination, im not very good at explaining things :S
Thx in advance :)