NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/PlayerSkill/Logic/PlayerSkillLogic04.cs

37 lines
1.3 KiB
C#

using System.Collections.Generic;
using Gameplay.Area;
using Gameplay.Common;
using Gameplay.Unit;
using Gameplay.Unit.Data;
namespace Gameplay.PlayerSkill.Logic
{
public class PlayerSkillLogic04 : PlayerSkillLogic01
{
protected override void _SearchUnits()
{
_selectUnits = new List<GameUnit>();
var influenceAreaId = owner.readySkillConfig.InfluenceAreaId;
var centerCellIndex = owner.selectedCellIndex;
var influenceCellIndexs = AreaManager.instance.GetCellIndexs(centerCellIndex, influenceAreaId);
for (int i = 0; i < influenceCellIndexs.Count; i++)
{
var cellIndex = influenceCellIndexs[i];
var units = AreaManager.instance.GetUnitsByCellIndex(cellIndex);
for (int j = 0; j < units.Count; j++)
{
var unit = units[j];
// 只针对敌方单位
if (unit.commonData.troopId == owner.playerUnit.commonData.troopId) continue;
// 只针对角色生效
if (unit.gameunitType != EGameUnitType.Character) continue;
// 重复的不添加
if (_selectUnits.Contains(unit)) continue;
_selectUnits.Add(unit);
}
}
}
}
}