Check state of variable for each item in an Array
I want to have a multi-condition trigger within my game where the player has to activate a number of buttons before a door opens. I have a rough Idea of what I need to do, this is more to see if I'm being an idiot and there's an easier / simpler way to do it.
Currently what's in my head is have an Array (buttonArray) and have a foreach within my script that checks each button in the array for an isActivated bool and if the button has been activated, it add's 1 to lets say "int buttonsActive" then if "buttonsActive is equal to the amount of buttons in the array, the door will open.
I don't see why this wouldn't work but haven't had a chance to give it a go yet so I thought instead of possibly wasting my time I'd ask if anyone has a better idea.
Thanks
Answer by Ak0rn · Jul 15, 2019 at 08:08 AM
Figured it out, if anyone else wants to know just send me a message and I'll give you a hand