I am using entity-base-components system.
I have many type of stationary objects
e.g.
- Wall = blocks
- Fire Turret = blocks + shooter
- Water Turret = blocks + shooter
- Bunker = blocks + spawner
Here is the factory of stationary objects
:-
class StationaryObject{
enum typeOfObject_enum{WALL,FIRE_TURRET, ....};
Entity* create(typeOfObject_enum theType){ //it is enum
switch(theType){
case WALL: ... create some mesh, some physic body ....
case FIRE_TURRET: .... create some mesh, some physic body+ unique logic 20 lines ....
....
}
}
}
It works really good.
Question:
Now I want to create 100 types of Stationary objects
, where should I store it?
Store all of them in class StationaryObject
will make the class too big (?).
Note that there are tiny-but-unique logic in each type of object.
Aucun commentaire:
Enregistrer un commentaire