Пример #1
0
    //TODO: pass in the character to use to construct player ownership
    public List <TalentTreeDisplayData> getTalentTreeDisplayData(GameCharacter gameCharacter)
    {
        List <TalentTreeDisplayData> talentTreeDisplayList = new List <TalentTreeDisplayData>();

        foreach (var talentData in gameDataSet.talentTreeDataDictionary.Values)
        {
            var  abilityData             = gameDataSet.abilityDataDictionary[talentData.AbilityID];
            bool playerOwned             = (gameCharacter.abilityList.Where(x => x.ID == abilityData.ID).Count() > 0) ? true : false;
            TalentTreeDisplayData tempTT = new TalentTreeDisplayData()
            {
                ID                    = talentData.ID,
                AbilityID             = abilityData.ID,
                AbilityDescription    = abilityData.description,
                AbilityName           = abilityData.name,
                SpriteSheetName       = abilityData.sheetname,
                SpriteSheetIndex      = abilityData.spriteindex,
                AP                    = abilityData.ap,
                levelReq              = talentData.levelReq,
                owned                 = playerOwned,
                unlocked              = getPlayerUnlocked(gameCharacter, talentData.levelReq, talentData.abilityReqs),
                range                 = abilityData.range,
                tag                   = talentData.tag,
                targetType            = abilityData.targetType,
                tier                  = talentData.tier,
                uses                  = abilityData.cooldown,
                tilePatternType       = abilityData.tilePatternType,
                abilityReqNameList    = getAbilityNameList(talentData.abilityReqs),
                effectDescriptionList = getEffectsDescriptionList(abilityData.passiveEffects, abilityData.activeEffects)
            };

            talentTreeDisplayList.Add(tempTT);
        }
        return(talentTreeDisplayList);
    }
Пример #2
0
    public void SelectTalentIcon(object talentTreeDataObject)
    {
        TalentTreeDisplayData tt = (TalentTreeDisplayData)talentTreeDataObject;

        if (tt.unlocked && !tt.owned)
        {
            if (curGameCharacter.talentPoints > 0)
            {
                var abilityData = gameDataObject.gameDataSet.abilityDataDictionary[tt.AbilityID];
                curGameCharacter.abilityList.Add(AbilityFactory.getAbilityFromAbilityData(abilityData, gameDataObject.gameDataSet.effectDataDictionary));
                curGameCharacter.talentPoints--;

                UpdateUI();
            }
        }
    }
Пример #3
0
    public void HoverTalentTree(object talentTreeDataObject)
    {
        if (hoverPopup == null && talentTreeDataObject != null)
        {
            hoverPopup = Instantiate(hoverPopupPrefab);
            hoverPopup.transform.SetParent(gameObject.transform);

            TalentTreeDisplayData tt = (TalentTreeDisplayData)talentTreeDataObject;
            UIHelper.UpdateTextComponent(hoverPopup, "Name", tt.AbilityName);
            UIHelper.UpdateTextComponent(hoverPopup, "Text1", tt.getDescription());
            if (!tt.unlocked)
            {
                var text2 = hoverPopup.GetComponentsInChildren <Text>()[2];
                text2.color = Color.red;
                text2.text  = tt.getRequirements();
            }
        }
        hoverPopup.transform.position = new Vector3(Input.mousePosition.x - .1f, Input.mousePosition.y - .1f, 0);
    }