Dynamic Components
Posted
by
Alex
on Game Development
See other posts from Game Development
or by Alex
Published on 2012-10-08T18:52:24Z
Indexed on
2012/10/08
21:51 UTC
Read the original article
Hit count: 190
I am attempting to design a component-based architecture that allows Component
s to be dynamically enabled and disabled, much like the system employed by Unity3D. For example, all Component
s are implicitly enabled by default; however, if one desires to halt execution of code for a particular Component
, one can disable it.
Naively, I want to have a boolean flag in Component
(which is an abstract class
), and somehow serialize all method calls into strings
, so that some sort of ComponentManager
can check if a given Component
is enabled/disabled before processing a method call on it. However, this is a pretty bad solution. I feel like I should employ some variation of the state paradigm, but I have yet to make progress.
Any help would be greatly appreciated,
© Game Development or respective owner