Пример #1
0
        IEnumerator AbilityEffect(Vector3 pos)
        {
            if (effectDelay > 0)
            {
                yield return(new WaitForSeconds(effectDelay));
            }

            List <Unit> tgtList = new List <Unit>();

            if (targetType == _TargetType.Hostile)
            {
                if (!requireTargetSelection)
                {
                    tgtList = SpawnManager.GetActiveUnitList();
                }
                else
                {
                    tgtList = SpawnManager.GetUnitsWithinRange(pos, stats.aoeRange);
                }
            }
            else if (targetType == _TargetType.Friendly)
            {
                if (!requireTargetSelection)
                {
                    tgtList = TowerManager.GetActiveUnitList();
                }
                else
                {
                    tgtList = TowerManager.GetUnitsWithinRange(pos, stats.aoeRange);
                }
            }
            else
            {
                if (!requireTargetSelection)
                {
                    tgtList = SpawnManager.GetActiveUnitList();
                    List <Unit> towerList = TowerManager.GetActiveUnitList();
                    for (int i = 0; i < towerList.Count; i++)
                    {
                        tgtList.Add(towerList[i]);
                    }
                }
                else
                {
                    tgtList = SpawnManager.GetUnitsWithinRange(pos, stats.aoeRange);
                    List <Unit> towerList = TowerManager.GetUnitsWithinRange(pos, stats.aoeRange);
                    for (int i = 0; i < towerList.Count; i++)
                    {
                        tgtList.Add(towerList[i]);
                    }
                }
            }

            for (int i = 0; i < tgtList.Count; i++)
            {
                tgtList[i].ApplyAttack(new AttackInfo(this, tgtList[i], false));
                effectOnTarget.Spawn(tgtList[i].GetTargetPoint(), Quaternion.identity);
            }

            yield return(null);
        }