public bool checkTwoVegetableSaladIngredients(TwoVegetableRecipe twoVegitableRecipe) { string sortedOrderedTwoVegetableSalad = sortSalad(orderedTwoVegetableSalad.ingredient1 + orderedTwoVegetableSalad.ingredient2); string sortedTwoVegitableRecipe = sortSalad(twoVegitableRecipe.ingredient1 + twoVegitableRecipe.ingredient2); if (sortedOrderedTwoVegetableSalad == sortedTwoVegitableRecipe) { return(true); } else { return(false); } }
// Request a random salad from the API data to order. public void requestRandomSalad() { if (SaladsAPI_Manager.Instance.saladsDataFetched) { if (GameManager.Instance.currentDifficultyLevel == GameManager.DIFFICULTY_LEVEL.EASY) { TwoVegetableRecipe randomTwoVegetableRecipe = SaladsAPI_Manager.Instance.twoVegetableRecipe[UnityEngine.Random.Range(0, SaladsAPI_Manager.Instance.twoVegetableRecipe.Count)]; Debug.Log("Random Salad : " + randomTwoVegetableRecipe.id); orderedTwoVegetableSalad = randomTwoVegetableRecipe; saladPlate.GetComponent <Image>().sprite = order(orderedTwoVegetableSalad.id); saladPlate.GetComponent <RectTransform>().sizeDelta = new Vector2(saladPlate.GetComponent <RectTransform>().sizeDelta.x, 12.5f); maximumWaitingTime = 30f; currentWaitingTime = 30f; waitingBar.fillAmount = currentWaitingTime; twoVegetableSalad = true; threeVegetableSalad = false; } else { ThreeVegetableRecipe randomThreeVegetableRecipe = SaladsAPI_Manager.Instance.threeVegetableRecipe[UnityEngine.Random.Range(0, SaladsAPI_Manager.Instance.threeVegetableRecipe.Count)]; Debug.Log("Random Salad : " + randomThreeVegetableRecipe.id); orderedThreeVegetableSalad = randomThreeVegetableRecipe; saladPlate.GetComponent <Image>().sprite = order(orderedThreeVegetableSalad.id); saladPlate.GetComponent <RectTransform>().sizeDelta = new Vector2(saladPlate.GetComponent <RectTransform>().sizeDelta.x, 12.5f); maximumWaitingTime = 35f; currentWaitingTime = 35f; waitingBar.fillAmount = currentWaitingTime; twoVegetableSalad = false; threeVegetableSalad = true; } customerState = CUSTOMER_STATE.WAITING; } else { Invoke("requestRandomSalad", 0.5f); } }