Is this method that i use for my coding structrue good?

Hi,
I’m working on an arcade car game, so i decided to create 3 script:


  1. CarController class → this class contain all car behavior like car handling methods, die method and etc.

  2. Player class → player object is a car so it needs CarController script and Player script. Player class contain all player behavior like score variable, Change score method and etc.

  3. AI class → AI objects are car so they need CarController script and AI script. AI class contain all AI behaviour like chasing player method and etc.

So now what’s your idea is this method that i use good?!

Thanks.

I don’t find anything wrong with it, but I would merge the player class’ scripts into one for making the score managing easier. For example, if you die it’s easier to set the score directly from the same script to 0 instead of one script making your character die and another one detecting that and then updating your score.