Hello,
I am in the process of making a game, and generally have a good concept of what I want to do but I always think there is a better way to program it, and end up scrapping everything and starting again!
The aim is to have the game on multiple platforms, and that controls for each action are user selected (from a selection) and that those inputs would also be associated with the appropriate game object.
What I am struggling with is how to do this…I have created a class called “inputmethod” which has a member function to setInput() which I imagined was going to then set an enum to determine what was pressed.
I also have an object class lets say its called “Shape”, and there are 5 child classes of shape called “Circle, Square, Triangle, Diamond, Cross”.
What I want to do on screen is have a selection screen come up with all 5 shapes, when selected I want an instance of that shape created and inputbuttons to be assigned to that class based on how it was selected.
I think an enum is best for the assignment, so if(input.getkeydown(“F1”){circle.assigninput(enum.whateveraction)}
which means I would declare the enum in the “inputmethod” class I think!
I seem to delay myself a lot due to wanting to have the perfect code but I don’t want to cause myself a lot of rework down the line, and this is my first game with unity.
My main problem is knowing what needs a class and what doesn’t, I don’t want to create a class for the sake of it, but I don’t want my code to be messy and all in one class either.
If anyone can make any sense out of what I was trying to say then input would be good! (no pun intended!)