So, we had to make a prototype for our game, before we gave it to our programmers. This was… fun. To start, we divided the tasks between us. My first main task was to get the connections working. I wasn’t entirely sure where to start this. So i began with being able to draw the lines with my mouse. Starting with a standard unity UI button, I created a system that would spawn a bar shaped button. I then made a system that would position it so that it was pointed towards the mouse cursor and would its width would be scaled to reach it. One issue I found with this was that the scale for the width will always be the same, but the mouse’s distance from the button will depend on the screen resolution. This was something that I didn’t have time to fix and so I left it to only work at one resolution, but created a scaling variable that lets you adjust it to suit the resolution. Once i could draw the lines, I created a thing to let you drag the lines after they were created, and also made systems to allow the lines to connect to new points. When this was done, I created systems to remove the lines if they weren’t connected to anything.
Now things were connected, I needed to make our shapes flow down the lines. To do this, since the lines were straight, I just made shapes spawn at the lines origin and made them move towards the end. However, these needed to only be sent if the origin is receiving shapes. To do this, the shapes needed to send information to the connection points, and the connection points needed to send information to the lines, which were spawning the shapes. So the shapes were flowing. But it was all one colour, we couldn’t use different signals. Now here’s where it gets messy. I started by numbering the signals, this was mostly simple, since it was just a number that could be passed between the points when they were connected, Getting them to reset when they disconnect was a little trickier, but that’s nothing compared to the mess that became the colouring of each line and connection point. This was a nightmare of if statements and multiple different points to do almost the same thing. But, it kind of worked. What I should have done was get the colours to be based off of the signal numbers, but that would have been the smart thing to do.
After this, I created the channel functionality. This could have been done better than it was, and it doesn’t entirely function correctly in it’s current state. I piggybacked off of the standard connection methods, but forgot to stop it from advancing the shape type and did not allow it to connect twice (which may or may not be good). Once I had done that, I needed to create the systems to allow connection points to accept multiple coloured inputs. This is where the train derailed. Because I hadn’t got the colours based off of the signal number, getting a colour to continue from the connection point would not work properly, since the connection point did not have a colour. I still need to fix this before we show our prototype to our programmers this tuesday, but there’s still time.
The rest of my team spent their time focusing on other areas of the game, such as UI or more in detail interactions with the connection points. After each of our parts are complete, the next more complex part is to try and combine them without breaking it. Fingers crossed it will work.