So I have been programming some inventory code for a unity project.
I have the Slot class which contains the logic that happens with that slot ( locking it, filling with content , freeing it etc).
However , I also found that I needed a SlotsController class which will control what happens with the Slot when I am clicking it, selecting multiple Slots, stacking them etc.
Example 1 : Slot will call the method OnClicked(Slot slot) , found on the controller, and then the controller will call the method Fill() found on the Slot.
Example 2 : The Controller has a slot already selected , and when I click another slot, I call the Stack() method on the other slot and Free() on the selected slot.
Now the question is: Is this the correct way to do it? Should I have all the Slot logic contained inside that class and only call it’s methods from the Controller class? I feel like the SlotController class is something like a Manager class which is quite a disregarded thing to do.
( I hope it’s clear enough , English is not my native language )