Hello all!
Coding C# question here!
I have inventory with 4 different objects: Lemon, Apple, Coffee, Mango
each object has different score: 20, 40, 60, 80 (respectively).
I want to use dictionary to assign the values. Dictionary<string, float> scoreDictionary = new Dictionary<string, float>()
Now whenever I see only apple, Lemon and Mango (or other combination), I want the method to sum their values
So my plane is to add each value to dictionary and then be able to sum the values based on the Key I get.
if ((rows[0].stoppedSlot != rows[1].stoppedSlot) && (rows[1].stoppedSlot != rows[2].stoppedSlot))
{
for (int i = 0; i < prizeDictionary.Count; i++)
{
// here summarize the three values I get
}
}
So basically, in other script I assign a string and add it’s name + value to a dictionary,
and in the other script I want to say, “take the strings that you get” and sum the values based on the string name.