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(); } }
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); }