c++ - Design choice with a container class that several classes use -
I have a class that wraps around a list called an explosion group (which I explain to the explosion (a Other class).
My basic design choice, and which was running for a while, was an explosion group in the 'level' class which runs all the levels. Any class (ships or owners) Like) that is caused by the explosions in those works, they crossed the tasks to this explosion group Originally, the level blast group had started sucking in all the blasts (hence it was called All Explosions).
void Foo :: Explode (AllExplosions and explosions) {. .. // Create an explosion explosion. Add (newexpliance);}
Recently I ran into a problem where this solution would not work because I did not have any of these functions Need to make an explosion, and only those functions Will pour. Make no sense and b) do not work correctly.
In this way I come up with the idea that each group that explodes has its own explosion group. This allows classrooms to be allowed to deal with the blasts, although they want, not at an event where an explosion group was passed. Then I wrote a texxplugon function for the Explosive group (which uses the bt of the std :: list), in which an explosion group parameter was taken and all the blasts of that group sucked. This is used in level with an accelerator for each class' ExplosionGroup.
void Foo: TeXexpliance (explosion group and explosion) {m_Explosions.splice (m_Explosions.end), explosion); }
I thought it was very good, but I realized that if I use this technique then I would like to use it for all the sections which are equally Can explode. However, in certain cases I would need to do this indirectly to achieve the explosions level explosions. For example, blockwalls in a boss class (block list), and the block explodes.
Thus, the wall of the block will need to remove the blast from its block, the boss will need to remove the blast from the wall of the block, and the level will need to be removed from the boss (unless I An Accelerator does not provide the Boss wall, which I do not intend to do.)
I do not really want to use a global container for the explosions, so that all classes Can add explosions as they please and be done with it, so I'm asking for any suggestions or ideas for this issue. I am also planning to handle the blasts in the level class and help each class to deal with it completely on its own, but it seems like a bad abstraction for me.
Some blockwalls Showexplugen (p_buffer); Playerships Show exploration (p_buffer); // looks ugly etc?
PS I understand that there is difficulty in answering such a question as to the actions of the game, animation, etc. I am also trying to use a global container because I am a little worried that playing with lists can all be effective. However, I have not made any outline, so I am not even trying to accept it.
I have no answer, there are only a few questions that others (and maybe even themselves) have a Will help find good answers.
- What are the exact steps to show the explosion?
- What are irreversible here? (Like all explosions are identical, object-specific, depending on time or situation at the level)
- What objects are included in showing explosion (renderers, clock, explosive object, etc.)?
There are several possible solutions, but it is difficult to select without knowing all the forces involved.
Comments
Post a Comment