Adam
Structure of system with polymorphism
I have a
Grid
with Cell
s, each Cell
has a CellEntities
list of CellEntity
. Each CellEntity
has a data object called CellEntityData
. Classes that derive from CellEntity
will have different functions, they could have different types of CellEntityData
, but the way I have things set up right now that's not necessary, but might be in the future.
But the important part is to be able to differentiate between different CellEntity
classes because I want Cell
to do different things depending on the CellEntity
(namely Instantiate different GameObjects in unity, among other things)
What is the best way to go about implementing entities with this framework?
Should CellEntity
and CellEntityData
be interfaces? Abstract classes?21 replies
Making my functions more generic
right now i have several functions that do essentially the same thing, the only difference being the type they take in
i have two data classes that have different data but both share one variable, a Tag class
i have two different functions to go through my database and get these data objects with a matching Tag, how would i go about combining these into one? making them both inherit from a class with a Tag or could i make the functions themselves generic?
24 replies