Hello, I’m currently working on a project like Anno but with more different buildings. I have set up a building class, which contains the variables for every building, like building cost, production time, resource to consume and generate etc.
Now i have to make a choice. The first option is to make for each building a sub class, which inherits from the building class, and override the variables to the values from this specific building, or the second option is I create a container which holds a struct or something for every possible building and by creating a new building i have to tell the building script, which building I want, and then load the data to this building from the container.
I ask this question because I want to know which method is better in the end. I think the first option allows me to make for example different animations for each building, because I can override an animation function or something. (I can do this with the second option too, but i have to check which building is currently loaded to the object and this will result in less readability with a lot of if statements and less performance). The second option is easy to menage. I can change all variables easily if the game was not properly balanced, or I would make some changes in production time, building cost etc.
I want to know how to tackle this problem and get the most advantages out of it.
This is obviously my first game and such decisions are very hard to make. Thanks for any help.