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()); }
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); } }
public void ChangeCoins(int amount) { _inventoryObject.SetCoins(_inventoryObject.GetCoins() + amount); _coinDisplay.UpdateCoins(_inventoryObject.GetCoins()); }