1: Grid system
I started with the implementation of a Grid class for my game field. The functionality of the standard unity grid class wasn’t enough for me, so I decided to implement my own. I watched several tutorials on YouTube and understood that it is a doable task.
What do I want from my Grid class?
- Size in terms of cells should be dynamically set in the inspector
- Unity world coordinates should be easily transformed into grid cell coordinates
- Grid cell coordinates should be easily transformed into Unity world coordinates
After I had finished the Grid, I implemented a building button. When you push the button, the circle appears near your pointer, and you are able to put the object on the grid. The color of the circle depends on its position. The color will be red if you can’t build the circle and blue otherwise.