Building up the battlecruiser from platforms!
https://i.gyazo.com/799db9c3c84bd6118c3e1c8ead0f744b.mp4I needed a random pick to spawn platforms with different amount of pins. There is a useful trick to make some random pick up. ( Well, mostly everyone knows how to do it, but I'll post for the beginners )
Now you can do something like this:
int sidesAmount = new float[4] { 50f, 25f, 18.5f, 6.5f }.ReturnRandom();
The idea is that only linked to "reactor" node platforms will be active. So I had to do some checkings if our platforms can reach the main node from a chain of connections.
With 4 sided platforms we can easily check neighbors for active pins. So the pin indexed 1 will refer to pin 3 from the right sided neighbor.
At first, I used the method from screen, but there is an alternative way to get pin index : )
for(int i = 0; i < 4; i++)
{
index = (i + 2) % 4
}