Beispiel #1
0
    public void ValidateOrder(Plate plate)
    {
        Order       current = new Order();
        AudioSource aSource = gameObject.GetComponent <AudioSource>();

        while (plate.items.Count > 0)
        {
            var ingredient = new Ingredient();
            ingredient.itype = plate.items.Pop().type;
            current.addIngredient(ingredient);
        }

        OnOrderCompleted.Invoke(final.IsSame(current));
        if (final.IsSame(current))
        {
            //Play Good Sound
            aSource.PlayOneShot(goodSound);
            gotoNextOrder();
        }
        else
        {
            //PLay Bad Sounf
            aSource.PlayOneShot(badSound);
        }
        plate.reset();
    }
        /// <summary>
        /// SubmitOrder does not return any form of Task, and we can’t await it.
        /// This doesn’t necessarily mean that it’s blocking. It might be using another form of asynchrony
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public Guid SubmitOrder(decimal price)
        {
            Guid orderId = Guid.NewGuid();

            // do a REST call over the network or something similar
            Task.Delay(3000).ContinueWith(task => OnOrderCompleted?.Invoke(this, new OrderOutcome(orderId, true)));

            return(orderId);
        }
Beispiel #3
0
 private void Flush()
 {
     OnOrderCompleted?.Invoke(this, new OrderCloseEventArgs {
         Order = _order
     });
     _order = null;
     TraceState.FlushOrderNumber();
     ChangeState(AttendantState.Idle);
 }
Beispiel #4
0
 public void RemoveOrder(Orders order)
 {
     OnOrderCompleted?.Invoke(order);
     currentOrders.Remove(order);
 }