Exemplo n.º 1
0
 public static void AddAction(MonopolyAction a)
 {
     //if the player got a double, we want the action of rerolling the dices to be kept at the end
     //of the action list when we are resolving all of the actions.
     //as all actions are not defined at the beginning (we don't know if the player will buy a property upon visiting
     //one, we need to make sure it is taken into account here as we keep the rolldice as the last action that should
     //resolve). This is the reason we can't use a Queue instead of a List (or we could by overriding the Enqueue()
     //method but it wouldn't make much sense and we'd loose the utility of a Queue)
     if (instance.Actions.Count > 1 && instance.Actions[instance.Actions.Count - 1].GetType() == typeof(RollDiceAction))
     {
         instance.Actions.Insert(instance.Actions.Count - 1, a);
     }
     else
     {
         instance.Actions.Add(a);
     }
 }
Exemplo n.º 2
0
 public static void AddInstantAction(MonopolyAction a)
 {
     instance.Actions.Insert(0, a);
 }