C
Chu
I've got a small problem I want to get some input on. I'm trying to
determine the best way to access a set of values. I've decided that I
should do it as either a Static class or as an actual object that I can
pass into each object. Let me attempt to describe the scenario:
During a battle, each player will be in control of X units. Each unit
has a set of values, such as Hitpoints, Shield Points, etc.
G-Man has 10 units. Chu has 10 units and Apep has 10 units.
Chu and Apep both attack G-man. The battle scenario runs Chu's attack
first, then Apep. Both players are attacking the same units belonging
to G-man so those Unit values need to somehow be shared between each of
the "attack objects" belonging to Apep and Chu. What's the best way to
share those unit values?
1- Make a Units class that pre-loads every unit object, then pass a
reference to that object into each of the attack objects and every
other object that uses it?
or
2- Use a static class that pre-loads each unit object, then have each
attack object simply reference the static unit class?
Suggestions? Pro's/con's of each method?
Thanks in advance.
Ry/Chu
determine the best way to access a set of values. I've decided that I
should do it as either a Static class or as an actual object that I can
pass into each object. Let me attempt to describe the scenario:
During a battle, each player will be in control of X units. Each unit
has a set of values, such as Hitpoints, Shield Points, etc.
G-Man has 10 units. Chu has 10 units and Apep has 10 units.
Chu and Apep both attack G-man. The battle scenario runs Chu's attack
first, then Apep. Both players are attacking the same units belonging
to G-man so those Unit values need to somehow be shared between each of
the "attack objects" belonging to Apep and Chu. What's the best way to
share those unit values?
1- Make a Units class that pre-loads every unit object, then pass a
reference to that object into each of the attack objects and every
other object that uses it?
or
2- Use a static class that pre-loads each unit object, then have each
attack object simply reference the static unit class?
Suggestions? Pro's/con's of each method?
Thanks in advance.
Ry/Chu