public void BuyAbility(AbilitySO SO) { //if the player has enough money as specified in the SO, if (spaceMoney.currencyAmount >= SO.cost && aManager.abilityDictionary[SO] == false) { FindObjectOfType <AudioManager>().Play("Purchase"); warningText.text = ("You have purchased the " + SO.name); //make the ability turn to true so it is useable once the game starts aManager.UpdateDictonary(SO, true); //and take away the money that is owed spaceMoney.currencyAmount -= SO.cost; coinAmount.text = spaceMoney.currencyAmount.ToString(); } //if player doesn't have enough money to purchase, tell them else if (spaceMoney.currencyAmount < SO.cost) { warningText.text = "You do not have enough money, please puchase more, play more or watch an ad"; } //if the player has already purchased the abilty, tell them else if (aManager.abilityDictionary[SO] == true) { warningText.text = "You have already purchased this ability"; } }
public void SetSelectedAbilityData(AbilitySO ability) { abilitiesTabCost.text = "cost: " + ability.cost.ToString(); abilitiesTabTitle.text = ability.title; selectedAbility = ability; if (GameDatas.HasAbility(ability.parentAbility)) { if (GameDatas.BankAccount >= ability.cost) { abilitiesTabDescription.text = ability.description; } else { abilitiesTabDescription.text = "You don't have enough money for this."; } } else { abilitiesTabDescription.text = "You should unlock the parent ability first."; } OnAbilitySelected?.Invoke(ability); }
public void BuyAbility(AbilitySO SO) { if (spaceMoney.currencyAmount >= SO.cost) { aManager.UpdateDictonary(SO, true); spaceMoney.currencyAmount -= SO.cost; } }
void OtherIconSelected(AbilitySO ability) { if (this.ability != ability) { this.selected = false; } SetBorderColor(); }
private void InitializeDictionary() { for (int i = 0; i < abilitySOs.Count; i++) { AbilitySO variable = abilitySOs[i]; if (!abilityDictionary.ContainsKey(variable)) { abilityDictionary.Add(variable, false); } } }
private void InitializeDictionary() { //for every ability SO added to the list of abilities for (int i = 0; i < abilitySOs.Count; i++) { AbilitySO variable = abilitySOs[i]; //if it is not in the list, if (!abilityDictionary.ContainsKey(variable)) { //add it and make sure it is set to false (so it will not run) abilityDictionary.Add(variable, false); Debug.Log("The " + variable.name + " is set to " + abilityDictionary[variable]); } } }
public void UpdateDictonary(AbilitySO ability, bool value) { abilityDictionary[ability] = value; }
public Abilities(AbilitySO ability) { this.ability = ability; }
public void PassStatsFromSO(AbilitySO inAbilitySO) { abilitySO = inAbilitySO; }