Shortened down, the process went pretty smoothly. I focused on smaller JavaScript concepts before delving into Unity’s own library of functions and changes they’ve done to the JavaScript language to fit their needs (API). These were/are simple information-storing or text-converting programs. I then decided to build upon a code that I had already done in Unity, which made a game object draggable, which would let it stay at its new location after the dragging stopped. I essentially needed to add something that checked if it was close enough to one of the resource tiles, so it would register that it could snap to that tile. This was done after Josh helped me grasp some concepts that could be used in practice.
After implementing the drag-and-drop snap-to-tile function, I had to have some way that it would check if there were any other player tokens in the resource tile, which could easily be done when I applied the same script that I used to snap to the tile, except checking for specific tokens this time. After some issues with it not properly going through the if-statements (coding snippets that it would go through ONLY if it met the criteria that had been set for the object) and some positioning scripts (where the game object is placed) that would go in the wrong order. After some trial and error, I was able to apply code that would first check if there was a player token in the first spot, and if there was, it would move on over to the second spot and do the same thing. If both spots were taken, it would simply return back to its original spot in front of the player and tell them that the tile is full.
Now that I had the placements right, I had to make a proper turn order where each player could place the first token they had, and then after everyone had placed their token, they could each place their second token in the same progression. This was done making a variable (a number, string of text or whatnot that could be changed on the spot) on each of the player token game objects that I set up as an integer (whole numbers), but acts like a Boolean (only values are if it’s true or if it’s false).
At the start of each game (and when the game is reset), it would set all the player turn variables to “false” (0), dictating that it was nobody’s turn to move, but change the first player’s (Logistics) to “true” (1). Then when they place their turn, their variable would turn to “false” (0) and then find out, using an array and another variable, who goes next, making their variable turn to “true” (1).
During all of this, I also had to create several extra functions that acted as “checkers”, that would compare the token’s name to a list and return a number or string that would correlate with the arrays that I had spread about. These numbers and strings were used to more easily use functions rather than writing a new function within every function.
While my other group mates used C# (c sharp), I focused on JavaScript (using Unity’s API and some minor non-Unity programs). I feel confident enough in JavaScript to do projects of my own. However, I notice that C# is extremely close to JavaScript, so maybe, just maybe, I’ve managed to learn two languages in one.