private void RefreshState(int newVal) { animalImage.sprite = GameSettings.I.GetSpriteForElement(animalType); animalNameText.text = animalType.ToString().ToUpper(); levelText.text = "Lvl " + (AnimalData.AnimalLevel(animalType) + 1); var level = AnimalData.AnimalLevel(animalType); var cost = GameSettings.I.GetSoftCurrencyForUpgrade(level); backImage.color = newVal >= cost ? upgradeableColor : normalColor; }
private void OnLevelUpButtonClick() { var currLevel = AnimalData.AnimalLevel(animalType); var cost = GameSettings.I.GetSoftCurrencyForUpgrade(currLevel); if (GameController.I.SoftCurrency >= cost) { AudioController.I.PlayPositiveSFX(true); AnimalData.IncreaseAnimalLevel(animalType); GameController.I.SoftCurrency -= cost; } }
public int Explode(int index) { if (isExploding) { return(0); } isExploding = true; StartCoroutine(DoExplodeAnimation(index)); // return score depending on level of element var level = AnimalData.AnimalLevel(Type); return(GameSettings.I.GetBasePointsForElementOfLevel(level)); }
private void RefreshView(TileElement.ElementType type, int softCurrency) { if (type == TileElement.ElementType.None) { return; } animalImage.sprite = GameSettings.I.GetSpriteForElement(type); animalNameText.text = type.ToString().ToUpper(); var currLevel = AnimalData.AnimalLevel(type); currentLevelText.text = "Lvl " + (currLevel + 1); var nextLevel = currLevel + 1; nextLevelText.text = "Lvl " + (nextLevel + 1); var currLevelBasePoints = GameSettings.I.GetBasePointsForElementOfLevel(currLevel); var nextLevelBasePoints = GameSettings.I.GetBasePointsForElementOfLevel(nextLevel); for (int i = 0; i < currentLevelPointTexts.Count; i++) { var currLevelPoints = (4 + i) * currLevelBasePoints * (i + 1); var nextLevelPoints = (4 + i) * nextLevelBasePoints * (i + 1); currentLevelPointTexts[i].text = (4 + i) + " line: " + currLevelPoints + "pts"; nextLevelPointTexts[i].text = "+ " + (nextLevelPoints - currLevelPoints); } var cost = GameSettings.I.GetSoftCurrencyForUpgrade(currLevel); levelUpCostText.text = softCurrency + "/" + cost; var canLevelUp = softCurrency >= cost; levelUpCostText.color = canLevelUp ? canLevelUpColor : missingSoftCurrencyColor; levelUpButton.interactable = canLevelUp; levelUpButtonText.color = levelUpButtonText.color.GetWithAlpha(canLevelUp ? 1f : 0.3f); }