public void endRace(bool didWin) { string winText = !didWin ? "You lose!" : "You win!\n\nPrize Money: $" + reward; winScreen.GetComponentInChildren <Text>().text = winText; winScreen.SetActive(true); state = states.END; timer = 5; foreach (GameObject glider in gliders) { glider.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition; } if (didWin) { InventoryPersist.setMoney(InventoryPersist.getMoney() + reward); SoundManager.Instance().StopBGM(); SoundManager.Instance().PlayAnySFX(SoundManager.SFXv2.Victory); } else { SoundManager.Instance().StopBGM(); SoundManager.Instance().PlayAnySFX(SoundManager.SFXv2.Loss); } }
void Update() { if (Input.GetKeyDown(KeyCode.M)) { InventoryPersist.setMoney(InventoryPersist.getMoney() + 100); } }
public void SetTextColorOnAffordability() { if (!item.CanAfford(InventoryPersist.getMoney())) { itemCostText.color = Color.red; } else { itemCostText.color = Color.red; } }
public void endRace() { winScreen.enabled = true; state = states.END; timer = 5; foreach (GameObject glider in gliders) { glider.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition; } InventoryPersist.setMoney(InventoryPersist.getMoney() + reward); }
public void BuySelectedItem() { //Pay(selectedItem); if (selectedItem.CanAfford(InventoryPersist.getMoney())) { //play "purchase made" sound InventoryPersist.setMoney(InventoryPersist.getMoney() - selectedItem.cost); selectedItem.UseItem(); } else { // play "purchase failed" sound, if wanted } }
public void BuySelectedItem() { //Pay(selectedItem); if (selectedItem.CanAfford(InventoryPersist.getMoney())) { // TODO play "purchase made" sound InventoryPersist.setMoney(InventoryPersist.getMoney() - selectedItem.cost); selectedItem.UseItem(); Debug.Log("Buy/use item"); SetFundsText(); CreateItemList(); SetCanBuyEachItem(); } else { // TODO play "purchase failed" sound, if wanted Debug.Log("Can't afford!"); } }
int GetPlayerMoney() { return(InventoryPersist.getMoney()); }