Пример #1
0
    public void Interact(InteractionType type)
    {
        if (type == InteractionType.PlaceDown)
        {
            m_IsInteracting = true;
            var veggie = m_playerController.PlayerInventory.RemoveVeggieFromInventory();

            if (veggie != null)
            {
                m_FreezeCuttingBoard = true;
                m_playerController.FreezePlayer(true);
                StartCoroutine(AddVeggieToSalad(veggie));
            }
        }
        else if (type == InteractionType.Pickup)
        {
            m_IsInteracting = true;

            while (m_CuttingBoardSalad.GetSize() > 0)
            {
                m_playerController.PlayerInventory.AddVeggiesToSalad(m_CuttingBoardSalad.Dequeue());
            }

            m_CuttingBoardSalad.ScrapSalad();
        }
    }
Пример #2
0
 void Start()
 {
     m_SpriteRenderer       = GetComponent <SpriteRenderer>();
     m_CustomerSalad        = this.GetComponent <CustomerSaladGenerator>().GetCustomerSalad();
     m_TotalWaitingTime     = m_CustomerSalad.GetSize() * WaitingTimeForEachVeggie;
     CustomerSaladText.text = m_CustomerSalad.GetSaladStringFromSalad();
 }
Пример #3
0
    public bool Equals(Salad otherSalad)
    {
        ///check for count if both have same number of elements

        if (SaladCombination.Count != otherSalad.GetSize())
        {
            return(false);
        }

        //both the sizes are equal
        int count = GetSize() - 1;

        while (count > 0)
        {
            var veggie1 = SaladCombination.Dequeue();
            var veggie2 = otherSalad.Dequeue();

            if (!veggie1.VegetableCode.Equals(veggie2.VegetableCode))
            {
                return(false);
            }

            count--;
        }

        return(true);
    }
Пример #4
0
    string GetTextFromQueue(Salad salad)
    {
        string saladStr = "Salad: ";
        int    i        = 0;

        while (i < salad.GetSize())
        {
            var veggie = salad.GetElementAt(i);
            saladStr += veggie.VegetableCode.ToString() + " ";
            i++;
        }
        return(saladStr);
    }