// Update is called once per frame
 void Update()
 {
     if (IsManed)
     {
         if (myState == CashierState.checking)
         {
             if (CustomersInLine.Count > 0)
             {
                 if (CustomersInLine[0].HasReachedDestination())
                 {
                     myState = CashierState.serving;
                     serving = servingTime;
                 }
             }
         }
         else if (myState == CashierState.serving)
         {
             serving -= Time.deltaTime;
             if (serving <= 0)
             {
                 myState = CashierState.checking;
                 CustomersInLine[0].Leave();
                 CustomersInLine.RemoveAt(0);
                 for (int i = 0; i < CustomersInLine.Count; i++)
                 {
                     CustomersInLine[i].SetNewDestinationInLine(GetPositionInLineById(i));
                 }
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Creates a sale
 /// </summary>
 /// <param name="date">Sale date</param>
 public void CreateSale(DateTime date)
 {
     if (State != CashierState.Editing)
     {
         Sale sale = new Sale(date);
         _currentSale = sale;
         State        = CashierState.Editing;
     }
 }
Пример #3
0
 /// <summary>
 /// Completes a sale.
 /// </summary>
 public void CompleteSale()
 {
     _salesDatabase.Save(_currentID, _currentSale);
     _currentSale.ID = _currentID;
     _currentID++;
     State = CashierState.Success;
     notify();
     CreateSale(_currentSale._date);
 }
Пример #4
0
        /// <summary>
        /// Updates the state and performs actions based on it.
        /// </summary>
        public void update()
        {
            CashierState state = _cashierModel.State;

            switch (state)
            {
            case CashierState.Success:
                Receipt r = new Receipt(_cashierModel.GetCurrentSale());
                r.Show();

                uxCart.Items.Clear();
                uxTotalCost.Text    = "Total Cost: $0.00";
                _cashierModel.State = CashierState.Initial;
                break;
            }
        }
Пример #5
0
 /// <summary>
 /// Cancels the current sale.
 /// </summary>
 public void CancelSale()
 {
     _currentSale = null;
     State        = CashierState.Initial;
 }