private void DoAttack(BattleAttackVO _vo, Action _del)
    {
        Vector3 pos = mapUnitDic [_vo.defender].transform.position;

        List <HeroBattle> attackers = new List <HeroBattle> ();

        List <HeroBattle> supporters = new List <HeroBattle> ();

        List <int> attackersDamage = new List <int> ();

        List <int> supportersDamage = new List <int> ();

        for (int i = 0; i < _vo.attackers.Count; i++)
        {
            attackers.Add(heroDic[_vo.attackers[i]]);

            attackersDamage.Add(_vo.attackersDamage[i]);
        }

        for (int i = 0; i < _vo.supporters.Count; i++)
        {
            supporters.Add(heroDic[_vo.supporters[i]]);

            supportersDamage.Add(_vo.supportersDamage[i]);
        }

        HeroBattle defender;

        if (heroDic.ContainsKey(_vo.defender))
        {
            defender = heroDic [_vo.defender];
        }
        else
        {
            defender = null;
        }

        BattleControl.Instance.Attack(attackers, pos, defender, supporters, _vo.defenderDamage, supportersDamage, attackersDamage, _del);
    }
Exemple #2
0
    private void ShowAttack(BattleAttackVO _vo)
    {
        BattleClickGo[] mArr;

        BattleClickGo[] oArr;

        BattleBase targetBase;

        if (battle.clientIsMine == _vo.isMine)
        {
            mArr = mPosArr;

            oArr = oPosArr;

            targetBase = oBase;
        }
        else
        {
            mArr = oPosArr;

            oArr = mPosArr;

            targetBase = mBase;
        }

        List <GameObject> list = null;

        for (int i = 0; i < _vo.damageData.Count; i++)
        {
            KeyValuePair <int, int> pair = _vo.damageData[i];

            if (pair.Key != -1)
            {
                LineRenderer lr = Instantiate(arrowRes);

                lr.SetPositions(new Vector3[] { mArr[_vo.pos].transform.position, oArr[pair.Key].transform.position });

                if (list == null)
                {
                    list = new List <GameObject>();
                }

                list.Add(lr.gameObject);
            }
            else
            {
                LineRenderer lr = Instantiate(arrowRes);

                lr.SetPositions(new Vector3[] { mArr[_vo.pos].transform.position, targetBase.transform.position });

                if (list == null)
                {
                    list = new List <GameObject>();
                }

                list.Add(lr.gameObject);
            }
        }

        if (list != null)
        {
            Action dele = delegate()
            {
                for (int i = 0; i < list.Count; i++)
                {
                    Destroy(list[i]);
                }
            };

            SuperTween.Instance.DelayCall(0.1f, dele);
        }
    }