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";
        }
    }
示例#2
0
    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);
    }
示例#3
0
    public void BuyAbility(AbilitySO SO)
    {
        if (spaceMoney.currencyAmount >= SO.cost)
        {
            aManager.UpdateDictonary(SO, true);

            spaceMoney.currencyAmount -= SO.cost;
        }
    }
示例#4
0
    void OtherIconSelected(AbilitySO ability)
    {
        if (this.ability != ability)
        {
            this.selected = false;
        }

        SetBorderColor();
    }
示例#5
0
    private void InitializeDictionary()
    {
        for (int i = 0; i < abilitySOs.Count; i++)
        {
            AbilitySO variable = abilitySOs[i];

            if (!abilityDictionary.ContainsKey(variable))
            {
                abilityDictionary.Add(variable, false);
            }
        }
    }
示例#6
0
    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]);
            }
        }
    }
示例#7
0
 public void UpdateDictonary(AbilitySO ability, bool value)
 {
     abilityDictionary[ability] = value;
 }
示例#8
0
 public Abilities(AbilitySO ability)
 {
     this.ability = ability;
 }
示例#9
0
 public void PassStatsFromSO(AbilitySO inAbilitySO)
 {
     abilitySO = inAbilitySO;
 }