public void ChangeButton(ShopButton button, buttonValue value) { if (value.Equals(buttonValue.ADD)) { button.buttonStatus = 0; button.GetComponent <Image>().sprite = shopInventory.shopButtonSprites[0]; //Debug.Log("CHANGED TO ADD BUTTON"); } else if (value.Equals(buttonValue.REMOVE)) { button.buttonStatus = 1; button.GetComponent <Image>().sprite = shopInventory.shopButtonSprites[1]; //Debug.Log("CHANGED TO REMOVE BUTTON"); } else if (value.Equals(buttonValue.SELL)) { button.buttonStatus = 2; //button.GetComponent<Image>().sprite = shopInventory.shopButtonSprites[2]; button.GetComponentInChildren <TMP_Text>().text = "SELL\n" + "$" + shopInventory.totalCost; //Debug.Log("CHANGED TO SELL BUTTON"); } else if (value.Equals(buttonValue.DONTSELL)) { button.buttonStatus = 3; //button.GetComponent<Image>().sprite = shopInventory.shopButtonSprites[3]; button.GetComponentInChildren <TMP_Text>().text = "DON'T SELL"; //Debug.Log("CHANGED TO DONTSELL BUTTON"); } }
void CheckBalance(ShopButton button) //checking if the player can affod the item { if (gameManager.Money() >= button.GetCost()) { int index = gameManager.GetMealIndex(button.NewMealName()); gameManager.AddToCurrent(index); StartCoroutine(gameManager.UpdateMoney(-button.GetCost(), -.5)); Debug.Log("Meal added to menu!!"); button.GetComponent <Button>().interactable = false; } else { Debug.Log("Not enough Money!!"); StartCoroutine(gameManager.FlashText(gameManager.moneyText)); } }