コード例 #1
0
ファイル: XMLFactory.cs プロジェクト: RuslanZdor/unity_mages
    public static AbstractAbilityEffect getEffect(XmlNode xmlEffect, object obj)
    {
        AbstractAbilityEffect effect = null;

        switch (xmlEffect["type"].InnerText)
        {
        case "DamageAbilityEffect":
            effect = new DamageAbilityEffect();
            break;

        case "AddBuffEffect":
        {
            var buffEffect = new AddBuffEffect {
                buff = (Buff)obj
            };
            effect = buffEffect;
            break;
        }

        case "RowAddBuffEffect":
        {
            AddBuffEffect buffEffect = new RowAddBuffEffect();
            buffEffect.buff = (Buff)obj;
            effect          = buffEffect;
            break;
        }

        case "HealAbilityEffect":
            effect = new HealAbilityEffect();
            break;

        case "SummonEffect":
            var sumEffect = new SummonEffect();
            sumEffect.person = ((SummonAbility)obj).person;
            effect           = sumEffect;
            break;

        case "UseItemEffect":
            effect = new UseItemEffect();
            break;

        case "AddShieldAbilityEffect":
            effect = new AddShieldAbilityEffect();
            break;

        case "RowAddShieldAbilityEffect":
            effect = new RowAddShieldAbilityEffect();
            break;
        }

        effect.targetsNumber = int.Parse(xmlEffect["targetsNumber"].InnerText);
        foreach (XmlNode attribute in xmlEffect["attributes"])
        {
            effect.attribures.Add(getEffectAttribures(attribute.InnerText));
        }

        effect.valueGenerator = getValueGenerator(xmlEffect["valueGenerator"]);

        return(effect);
    }
コード例 #2
0
ファイル: MeleeAttack.cs プロジェクト: RuslanZdor/unity_mages
    public MeleeAttack(string n)
    {
        name       = n;
        timeCast   = Constants.PERSON_MELEE_ATTACK_SPEED;
        targetType = AbilityTargetType.ENEMY;
        image      = Constants.loadSprite("texture/Skills/buffIcons", "buffIcons_2");
        type       = "activeAbility";
        setAbstractTactic(new MeleeAttackTactic(1));
        isActive = true;

        AbstractAbilityEffect effect = new DamageAbilityEffect();

        effect.targetsNumber  = 1;
        effect.valueGenerator = new ConstantValueGenerator(1);
        effectList.Add(effect);

        targetTactic = new RandomTargetTactic();
    }