Esempio n. 1
0
 private void Start()
 {
     _itemDisplay = FindObjectOfType <ItemDisplay>();
     _coinDisplay = FindObjectOfType <CoinDisplay>();
     _itemDisplay.UpdateContainers(_inventoryObject.GetItems().Count);
     _itemDisplay.UpdateSelectedItem(_selectedItem);
     _itemDisplay.UpdateItems(_inventoryObject.GetItems());
     _coinDisplay.UpdateCoins(_inventoryObject.GetCoins());
 }
Esempio n. 2
0
    public void PlayerDied()
    {
        currentPlayerLives--;
        hearts.SetHearts(currentPlayerLives);

        if (currentPlayerLives <= 0)
        {
            //restart game
            SceneManager.LoadScene(0);
            Destroy(gameObject);
        }
        else
        {
            //restart scene
            currentCoins = coinsAtLevelStart;
            coins.UpdateCoins(currentCoins);
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
    }
Esempio n. 3
0
 public void ChangeCoins(int amount)
 {
     _inventoryObject.SetCoins(_inventoryObject.GetCoins() + amount);
     _coinDisplay.UpdateCoins(_inventoryObject.GetCoins());
 }