Esempio n. 1
0
 public void setAbilityTactic(SummonCastTactic abilityTactic)
 {
     this.abilityTactic = abilityTactic;
 }
Esempio n. 2
0
    public static Ability loadAbility(string abilityLink)
    {
        var textAsset = (TextAsset)Resources.Load(abilityLink);
        var xmldoc    = new XmlDocument();

        xmldoc.LoadXml(textAsset.text);
        var xmlAbility = xmldoc.GetElementsByTagName("ability").Item(0);

        Ability ability = null;

        switch (xmlAbility["type"].InnerText)
        {
        case "basicAbility":
            ability = new Ability();
            ability.setAbstractTactic(new DamageSpellCastTactic(3));
            break;

        case "summonAbility":
            var summon        = loadPerson(xmlAbility["summon"].InnerText);
            var summonAbility = new SummonAbility();

            var tactic = new SummonCastTactic(3);
            tactic.summon = summon;

            summonAbility.setAbstractTactic(tactic);
            summonAbility.person = summon;
            ability = summonAbility;
            break;

        case "buffAbility":
        case "passiveAbility":
            var buff = new Buff();
            buff.setAbstractTactic(new DamageSpellCastTactic(3));
            buff.modificator = getModificators(xmlAbility["modificators"])[0];
            buff.duration    = float.Parse(xmlAbility["duration"].InnerText);
            ability          = buff;
            break;

        case "activeBuff":
            ability = new ActiveBuff();
            ability.setAbstractTactic(new DamageSpellCastTactic(3));
            break;
        }

        ability.name         = xmlAbility["name"].InnerText;
        ability.type         = xmlAbility["type"].InnerText;
        ability.resource     = abilityLink;
        ability.timeCast     = float.Parse(xmlAbility["timeCast"].InnerText);
        ability.manaCost     = float.Parse(xmlAbility["manaCost"].InnerText);
        ability.cooldown     = float.Parse(xmlAbility["cooldown"].InnerText);
        ability.targetType   = getTargetType(xmlAbility["targetType"].InnerText);
        ability.targetTactic = getTargetTactic(xmlAbility["targetTactic"].InnerText, ability);
        ability.animation    = xmlAbility["animation"].InnerText;
        ability.image        = Constants.loadSprite(xmlAbility["sprite"].InnerText, xmlAbility["image"].InnerText);
        foreach (XmlNode node in xmlAbility["effects"])
        {
            ability.effectList.Add(getEffect(node, ability));
        }

        return(ability);
    }