In the first week of the project I have decided to write a few classes to get a feel for the difficulty of the project. That is when I found my first wall.
In unity, if you inherit from Monobehavior (make the class a component) you can't initialize the class with the "new" keyword. So I had to look for a solution for that, and what I came up with would not work with the design that I previously had. After a few hours of research, I came to the conclusion that I needed to use the fearsome term "Design Patterns".
I have never worked nor had any idea on what a "Design Pattern" looked like, the only thing I knew is that it was used to define a structure to the classes and interfaces of the project.
After watching and reading a few lessons, I started getting the overall idea behind the different design patterns, more specifically: strategy, observer, factory and singleton patterns. Reading a bit more on each one I decided that the best design pattern to use in the current phase of my project was the factory pattern with a few touches of strategy pattern here and there, since it allows me to have a single class controlling what types of buildings and agents would be created. Instead of having to call multiple methods, now I have one "makeBuilding()" method that I can instantiate any building in the game.
After finished the Building interface and implemented a few classes, I could finally test it in the game. For my surprise it worked like a charm, now I can simply call "makeBuilding(buildingClass.residential)" and it will do just that. Wonderful! Now I'm just missing the position and checking if it was an available position (not occupied), but I don't think that would be a major task.
On the 3rd day on development I decided to start making the agents (people and vehicles) interface. I quickly noticed that the agents would have a much more complex structure compared to the buildings. So I paused the coding and went ahead to a new subject that I also had never worked with before: UML Diagrams.
Looking for a way to visualize the structure and how everything worked together, I went to Youtube and a few websites and looked for tuturials on UML Class Diagrams. after a couple hours I felt ready to try and design my first diagram.
I am still having trouble with the different arrow heads symbols and associations but for now it will do the job. There are probably major flaws on the diagram, but again, this is the first time i'm dealing with design patterns and UML.
This is about everything I could accomplish this week between my college classes and homework. Next week I will probably have the agents interface done and will be starting with the interaction between agents and buildings, so keep checking back for more updates.