I have a "character" and the character have an array (or list, or dictinary) of "effects" applied to them. Each "effect" is a struct that changes certain parameters. What is the most efficient type of array to use in this case, and what is the best way to iterate through them if that may have to be used quite often.
EDIT: it goes something like this
public class hero { int level; public int moveSpeed; Dictionary<effect> = effects;
int GetSpeed (){
int m = movespeed;
foreach (effect in effects) {
if (type = "movement")
m += effect.value;
}
return m;
}
}
public struct effect {string type; int value;}
public static void Main (string args) {
hero Baragorn = new hero();
Baragorn.speed = 10;
effect swamp = new effect();
swamp.type = "movement";
swamp.value = -3;
Baragorn.effects.add(swamp)
printf(Baragorn.GetSpeed().ToString());
}