Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.M))
     {
         InventoryPersist.setMoney(InventoryPersist.getMoney() + 100);
     }
 }
Ejemplo n.º 3
0
 public void SetTextColorOnAffordability()
 {
     if (!item.CanAfford(InventoryPersist.getMoney())) {
         itemCostText.color = Color.red;
     } else {
         itemCostText.color = Color.red;
     }
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
    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
        }
    }
Ejemplo n.º 6
0
    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!");
        }
    }
Ejemplo n.º 7
0
 int GetPlayerMoney()
 {
     return(InventoryPersist.getMoney());
 }