Пример #1
0
 public TheGame(int numberOfPlayers, int numberOfSnacks)
 {
     NumberOfPlayers = numberOfPlayers;
     for (int i = 0; i < numberOfPlayers; i++)
     {
         Snakes.Add(new Snake(40, 20, i));
     }
     for (int i = 0; i < numberOfSnacks; i++)
     {
         Snacks.Add(new Snack());
     }
 }
Пример #2
0
        public void AddSnack(Snack snack)
        {
            if (snack != null)
            {
                var apply = snack.ApplyLightPromotion(snack);
                Snacks.Add(snack);

                if (apply)
                {
                    TotalPrice += (snack.TotalPrice - (snack.TotalPrice * 0.1));
                }
                else
                {
                    TotalPrice += snack.TotalPrice;
                }
            }
        }
Пример #3
0
 public void AddItem(Snack snack)
 {
     //add is the new push
     Snacks.Add(snack.Name, snack);
 }
Пример #4
0
 public void AddItem(Snack snack)
 {
     Snacks.Add(snack);
 }