how to make game objects to contain other objects?
Posted
by
user3161621
on Game Development
See other posts from Game Development
or by user3161621
Published on 2014-06-06T07:53:31Z
Indexed on
2014/06/06
9:42 UTC
Read the original article
Hit count: 137
c#
Im pretty undecided about what path to take here. The simplest that comes to mind is just adding a field List to the GameObject class where i would store the things contained in it. But would it be elegant and well tought? And would it be good performance wise?(ofc 99.9% of my objects wouldnt have anything stored in them...)
What about deriving a ContainerObject from GameObject? This way only they would have additional fields but then i would have to change many things, my collections of objects would have to become a generic and id have to cast very often into GameObject...
© Game Development or respective owner