示例#1
0
 public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count == 0)
     {
         _gumballMachine.SetState(_gumballMachine.SoldOutState);
     }
     else
     {
         _gumballMachine.ReleaseBall();
         Console.WriteLine("You are winner! Got another gumball");
         if (_gumballMachine.Count > 0)
         {
             _gumballMachine.SetState(_gumballMachine.NoQuarterState);
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs");
             _gumballMachine.SetState(_gumballMachine.SoldOutState);
         }
     }
 }
 public void Dispense()
 {
     gumballMachine.ReleaseBall();
     if (gumballMachine.GetCount() > 0)
     {
         gumballMachine.SetState(gumballMachine.GetNoTokenState());
     }
     else
     {
         Debug.Log("Opps! out of gumballs!");
         gumballMachine.SetState(gumballMachine.GetSoldOutState());
     }
 }
 public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count > 0)
     {
         _gumballMachine.State = _gumballMachine.NoQuarterState;
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         _gumballMachine.State = _gumballMachine.SoldOutState;
     }
 }
示例#4
0
 public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count == 0)
     {
         _gumballMachine.SetState(_gumballMachine.SoldOutState);
     }
     else
     {
         _gumballMachine.ReleaseBall();
         Console.WriteLine("YOU'RE A WINNER! You got two gumballs for your quarter");
         if (_gumballMachine.Count > 0)
         {
             _gumballMachine.SetState(_gumballMachine.NoQuarterState);
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs!");
             _gumballMachine.SetState(_gumballMachine.SoldOutState);
         }
     }
 }
示例#5
0
 public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.GetCount() > 0)
     {
         _gumballMachine.SetState(_gumballMachine.GetNoQuarterState());
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
     }
 }
 public void Dispense()
 {
     gm.ReleaseBall();
     if (gm.Count > 0)
     {
         gm.State = gm.NoQuarterState;
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         gm.State = gm.SoldOutState;
     }
 }
        public override void Dispense()
        {
            GumballMachine.ReleaseBall();

            if (GumballMachine.GetCount() > 0)
            {
                GumballMachine.SetState(GumballMachine.GetNoQuarterState());
            }
            else
            {
                GumballMachine.SetState(GumballMachine.GetSoldOutState());
            }
        }
示例#8
0
 public void Dispense()
 {
     Console.WriteLine("You are a winnner you get 2 gumballs ");
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count == 0)
     {
         _gumballMachine.State = _gumballMachine.SoldOutState;
     }
     else
     {
         _gumballMachine.ReleaseBall();
         if (_gumballMachine.Count > 0)
         {
             _gumballMachine.State = _gumballMachine.NoQuarterState;
         }
         else
         {
             Console.WriteLine("You are running out of gumballs");
             _gumballMachine.State = _gumballMachine.SoldOutState;
         }
     }
 }
示例#9
0
 public void Dispense()
 {
     gumballMachine.ReleaseBall();
     if (gumballMachine.GetCount() == 0)
     {
         gumballMachine.SetState(gumballMachine.GetSoldOutState());
     }
     else
     {
         gumballMachine.ReleaseBall();
         System.Console.WriteLine("YOU’RE A WINNER! You got two gumballs for your quarter");
         if (gumballMachine.GetCount() > 0)
         {
             gumballMachine.SetState(gumballMachine.GetNoQuarterState());
         }
         else
         {
             System.Console.WriteLine("Oops, out of gumballs!");
             gumballMachine.SetState(gumballMachine.GetSoldOutState());
         }
     }
 }
示例#10
0
 public void Dispense()
 {
     Console.WriteLine("You are a WINNER! You get two gumballs for your quarter.");
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count > 0)
     {
         _gumballMachine.ReleaseBall();
         if (_gumballMachine.Count > 0)
         {
             _gumballMachine.SetState(_gumballMachine.GetNoQuarterState());
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs!");
             _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
         }
     }
     else
     {
         _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
     }
 }
示例#11
0
 public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count > 0)
     {
         _gumballMachine.SetState(_gumballMachine.NoQuarterState);
     }
     else
     {
         Console.WriteLine("It was last gumball, please ask administrator to add gumballs");
         _gumballMachine.SetState(_gumballMachine.SoldOutState);
     }
 }
示例#12
0
        public void Dispense()
        {
            Console.WriteLine("You're a winner! You get 2 gumballs for your quarter");
            _gumballMachine.ReleaseBall();

            if (_gumballMachine.GetCount() == 0)
            {
                _gumballMachine.SetState(_gumballMachine.GetNoQuarterState());
            }
            else
            {
                _gumballMachine.ReleaseBall();
                if (_gumballMachine.GetCount() > 0)
                {
                    _gumballMachine.SetState(_gumballMachine.GetNoQuarterState());
                }
                else
                {
                    Console.WriteLine("Out of gumballs");
                    _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
                }
            }
        }
示例#13
0
    public void Dispense()
    {
        machine.ReleaseBall();

        if (machine.Count > 0)
        {
            machine.State = machine.noQuarterState;
        }
        else
        {
            System.Console.WriteLine("Oops, out of gumballs!");
            machine.State = machine.soldOutState;
        }
    }
    public void Dispense()
    {
        machine.ReleaseBall();
        if (machine.Count == 0)
        {
            machine.State = machine.soldOutState;
        }
        else
        {
            machine.ReleaseBall();
            System.Console.WriteLine("YOU ARE A WINNER! You got two gumballs for your quarter");

            if (machine.Count > 0)
            {
                machine.State = machine.noQuarterState;
            }
            else
            {
                System.Console.WriteLine("Oops, out of gumballs!");
                machine.State = machine.soldOutState;
            }
        }
    }
        public override void Dispense()
        {
            gumballMachine.ReleaseBall();

            if (gumballMachine.CountGumBall > 0)
            {
                gumballMachine.SetCurrentState(gumballMachine.NoQuarterState);
            }
            else
            {
                // todo: Oops, out of gumballs
                //gumballMachine.SetCurrentState(gumballMachine.SoldOutState);
            }
        }
        public void Dispense()
        {
            gumballMachine.ReleaseBall();

            if (gumballMachine.GetCount() > 0)
            {
                gumballMachine.SetState(gumballMachine.GetNoQuarterState());
            }
            else
            {
                view.DisplayMessage("Oops, out of gumballs.");
                gumballMachine.SetState(gumballMachine.GetSoldOutState());
            }
        }
示例#17
0
 public void Dispense()
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("YOU ARE A WINNER!!! You get two gumballs for your quarter");
     Console.ResetColor();
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.GetCount() == 0)
     {
         _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
     }
     else
     {
         _gumballMachine.ReleaseBall();
         if (_gumballMachine.GetCount() > 0)
         {
             _gumballMachine.SetState(_gumballMachine.GetNoQuarterState());
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs!");
             _gumballMachine.SetState(_gumballMachine.GetSoldOutState());
         }
     }
 }
示例#18
0
        public override void Dispense()
        {
            Console.WriteLine("Поздравляю, Ты WINNER!!! Получай дабл");
            _gumballMachine.ReleaseBall();
            //if (_gumballMachine.Count == 0)
            //    _gumballMachine.State = _gumballMachine.Sold_out;
            //else
            //{
            //    _gumballMachine.ReleaseBall();
            //    if (_gumballMachine.Count > 0)
            //        _gumballMachine.State = _gumballMachine.No_quarter;
            //    else
            //    {
            //        Console.WriteLine("Нет шароV");
            //        _gumballMachine.State = _gumballMachine.Sold_out;
            //    }

            //}
        }
示例#19
0
 public override void Dispense()
 {
     "You're a winner! You get two gumballs for your quarter".P();
     GumballMachine.ReleaseBall();
     if (GumballMachine.Count == 0)
     {
         GumballMachine.SetState(GumballMachine.SoldOutState);
     }
     else
     {
         GumballMachine.ReleaseBall();
         if (GumballMachine.Count > 0)
         {
             GumballMachine.SetState(GumballMachine.NoQuarterState);
         }
         else
         {
             "Oops, out of gumballs".P();
             GumballMachine.SetState(GumballMachine.SoldOutState);
         }
     }
 }
示例#20
0
        public override void Dispense()
        {
            Console.WriteLine("YOU ARE A WINNER! You get two gumballs for youre quarter");
            GumballMachine.ReleaseBall();

            if (GumballMachine.GetCount() == 0)
            {
                GumballMachine.SetState(GumballMachine.GetSoldOutState());
            }
            else
            {
                GumballMachine.ReleaseBall();
                if (GumballMachine.GetCount() > 0)
                {
                    GumballMachine.SetState(GumballMachine.GetNoQuarterState());
                }
                else
                {
                    Console.WriteLine("Oops out of gumballs!");
                    GumballMachine.SetState(GumballMachine.GetSoldOutState());
                }
            }
        }