How to make a electric/energy system?
Hello,
How would one make a radius electric/energy system? For example:
Player places 1 generator that has a certain radius and all the buildings in that radius would have electricity and if not they would be offline?
Would a collider work? I was thinking of making the collider bigger than the actual building and everything that hit's would be affected? Could this affect performance?
I'm just trying to figure out on what the best way to do this would be.
Thanks in advance.
Hi, I think it can be a good way. Another way is to check the distance of the generator/building and if it is close enough it will enable.
Answer by tormentoarmagedoom · May 22, 2018 at 09:47 PM
Good day.
Depending on the numbers og generators, but best way is to create a big collider marked as trigger in the buildings, so it can detect if another collider called or tagged "Generator" is inside.
You can also create an array of all generators in the map, so each building can check if have some of them at a distance of xxxx.
Bye!