public void AddAbilityText(AbilityText abilityText)
    {
        GameObject popup          = Instantiate(announcementBox, gameObject.GetComponentInParent <Transform>());
        int        newType        = abilityText.TextType;
        int        totalOfType    = 0;
        bool       abilityUpdated = false;

        AbilityInventory.Add(abilityText);
        foreach (AbilityText a in AbilityInventory)
        {
            if (a.TextType == newType)
            {
                totalOfType++;
            }
        }
        if (totalOfType >= abilityTotals[newType])
        {
            if (UnlockAbility != null)
            {
                UnlockAbility.Invoke(newType);
            }
            for (int i = 0; i < AbilityInventory.Count; i++)
            {
                if (AbilityInventory[i].TextType == newType)
                {
                    if (!abilityUpdated)
                    {
                        AbilityInventory[i].BaseText        = abilityNames[newType];
                        AbilityInventory[i].DescriptionText = abilityDescriptions[newType];
                        abilityUpdated = true;
                        popup.GetComponentInChildren <Text>().text = "You have unlocked " + AbilityInventory[i].DisplayText;
                    }
                    else
                    {
                        AbilityInventory.Remove(AbilityInventory[i]);
                        i--;
                    }
                }
            }
        }
        else
        {
            popup.GetComponentInChildren <Text>().text = "You got " + abilityText.DisplayText;
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     camera = FindObjectOfType <Camera>();
     if (puzzleText.BaseText == "")
     {
         puzzleText = null;
     }
     if (abilityReward.BaseText == "")
     {
         abilityReward = null;
     }
     if (dialogueText_Problem == "")
     {
         PuzzleSolved = 1;
     }
     else
     {
         PuzzleSolved = 0;
     }
 }