/// <summary>
    ///
    /// Gets a hero of a particular tier level and class
    ///
    /// </summary>
    public UnitData GetHero(Classes.ClassList neededClass, TierLevel heroTierLevel, TierLevel abilityTierLevel)
    {
        if (neededClass != Classes.ClassList.Default)
        {
            var heroTier = new HeroTier()
            {
                HeroClass = neededClass, TierLevel = heroTierLevel
            };
            var abilityTier = new HeroTier()
            {
                HeroClass = neededClass, TierLevel = abilityTierLevel
            };

            HeroLookup.TryGetValue(heroTier, out var heroData);
            HeroAbilityLookup.TryGetValue(abilityTier, out var abilityData);

            //Removes the default ability on the hero card and replaces it with the required ability
            heroData.Abilities.Clear();
            heroData.Abilities.Add(abilityData);

            return(heroData);
        }
        else
        {
            throw new Exception("Cannot get hero from Default class");
        }
    }
    /// <summary>
    ///
    /// Constructs the hero lookup dictionary. The hero lookup is used to construct the different combinations of heroes and abilities
    ///
    /// </summary>
    private void ConstructHeroLookup()
    {
        var tempHeroLookup = new Dictionary <Classes.ClassList, List <CardData> >();

        HeroLookup        = new Dictionary <HeroTier, UnitData>();
        HeroAbilityLookup = new Dictionary <HeroTier, AbilityData>();

        foreach (var cardClass in Enum.GetValues(typeof(Classes.ClassList)).Cast <Classes.ClassList>())
        {
            if (!InvalidClasses.Contains(cardClass))
            {
                //Obtain all the heroes for a particular class. Intersects the rarity lookup and the classlookup
                tempHeroLookup.Add(cardClass, RarityLookup[Rarity.Hero].Intersect(ClassLookup[cardClass]).ToList());

                foreach (var card in tempHeroLookup[cardClass])
                {
                    var heroCard = (UnitData)card;
                    var heroTier = new HeroTier()
                    {
                        HeroClass = cardClass, TierLevel = HeroTier.ConvertTierLevel(heroCard)
                    };
                    HeroLookup.Add(heroTier, heroCard);

                    var heroAbility = heroCard.Abilities.FirstOrDefault(); //Should only be one element in the hero ability list
                    HeroAbilityLookup.Add(heroTier, heroAbility);
                }
            }
        }
    }
Example #3
0
    protected void SetHolderGraphic(HeroTier tier)
    {
        Sprite graphic;

        switch (tier)
        {
        case HeroTier.tier1:
            graphic = data.tier1Graphic;
            break;

        case HeroTier.tier2:
            graphic = data.tier2Graphic;
            break;

        case HeroTier.tier3:
            graphic = data.tier3Graphic;
            break;

        default:
            graphic = data.tier1Graphic;
            break;
        }
        holderGraphic.sprite = graphic;
    }
Example #4
0
 public TierLevel GetHeroTier()
 {
     return(HeroTier.ConvertTierLevel(this));
 }