Jump to content
  • Advertisement
Sign in to follow this  
Icebone1000

I need a structure for combination of keys associated with a value..

This topic is 2495 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Damn, I cant resolve myself with this...
I have 2 "categories" lets say, one inside another, but depending of the external one, the internal results in a different value...What data structure can I use for this..( Its C#)

Example:

External categories: Frontal, Lateral, Back, Internal
Internal categories: Red, Blue, Yellow, Pink, Black, White

When the active category is Frontal, Red means something, when is Lateral, Red means another thing..Im implementing the categories as enums..
"Something" and "another thing" also are categories @__@... i.e.: Frontal/Red = Visual; Lateral/Red = Economy;

Damn...Im confuse..I also think Visual and Economy would need to be associated with an index on an array, but it would be a different index depending on the categories...not sure..i.e.:
Frontal/Red = Visual.index = 1; Lateral/Blue = Visual.index = 4;
*mind blows*

How can I explain this more concrete..Its a game where the player needs to select the parts of an object(4 parts), this selected part will show 4 options .
Each part selected represent a category of options, but the category isnt always the same for the same selected part, it will change due different cam angles( 4 possible cam angles to choose)..
Means theres a total of 64 options...

Maybe theres an ridiculous easy path between all that mess.

Share this post


Link to post
Share on other sites
Advertisement
Frontal, Lateral, Back, Internal = values 0 -> 3
Red, Blue, Yellow, Pink, Black, White = values -> 0 -> 5

For your data you have an array of (4 * 6) elements. The first 6 elements contain whatever data you want when the primary key is 'frontal', the next 6 when 'lateral' etc.

When you need to find data lookup into the array ((<primary> * 6) + <colour>) to get your index.

For the different camera angles just have an array of the above;

(Vague C# like code)

List<List<int>> views = new List<List<int>>(4);
for i = 0; i < 4; ++i
views = new List<int>(elementCount)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!