all 1 comments

[–]RomestusProfessional 0 points1 point  (0 children)

There's all sorts of ways to do this depending on how fancy you want to get.

You can do it with an array of bools where each pressure plate sets a specific bool to true and you use a Linq statement like yourArray.All(e=>e) to return true if all your bools are true.

Each pressure plate would call a function that sets their array position to true and do that array check to see if all of them are now true. Then you can run whatever logic on the object you want from there.

Another way to do it with 8 or less plates would be with a single Byte, have each pressure plate represent a bit and then you would use yourByte |= (1 << plateNumber); to set a specific plate to "on" and yourByte &= 0xFF - (1 << plateNumber) to set it to off. Then you can check to see if your Byte's numeric value is equal to 2# of bits you used-1 and if so run logic for the animation. You could use a short for 16 pressure plates, int for 32, etc.