I’d like to implement the lights and light switches system into my project and I’m not sure how to achieve it/achieve it correctly.
The desired result - I’d like to have various types of actors representing different types of lights (chandeliers etc.) and an universal light switch actor which could be “befriended” with any of the previous mentioned lights.
In result it could be like this: there are rooms A and B. Room A has 2 chandeliers and 1 switch, B has 1 chandelier and 2 switches and any switch controls only the chandelier/s in its room.
When I was trying the very basics, I managed to toggle a point light using a trigger and a level blueprint. Maybe I haven’t simply understood the philosophy behind the level blueprints but it feels like they can become really messy soon, so I don’t feel like using it if not necessary.
There’s a parent blueprint “universal light” which has an int variable “index”. Every light blueprints have the “universal light” as a parent, so they (I suppose) also have the “index” variable.
The switch actor also gets the variable “index” and if any of the lights have the same “index” as the switch, the switch controls them.
I guess the switch would call the “universal light” parent in a proximity and if the light being called because of it parent had the same index, it would run the toggle function.
I’m not exactly sure how it works in the UE yet, that’s how I would execute it in Game Maker with which I’ve been working for over a decade, so maybe my idea is bad in the UE’s environment, I don’t know yet.
Thank you in advance for any suggestions.