2023-12-13 14:58:11 +08:00
|
|
|
|
using Gameplay.Area;
|
|
|
|
|
|
using Gameplay.Common;
|
2023-12-13 16:20:41 +08:00
|
|
|
|
using Gameplay.Unit;
|
|
|
|
|
|
using Gameplay.Unit.Data;
|
2023-12-13 14:58:11 +08:00
|
|
|
|
namespace Gameplay.PlayerSkill.Logic
|
|
|
|
|
|
{
|
|
|
|
|
|
public class PlayerSkillLogic06 : BasePlayerSkillLogic
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
protected override void _OnInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
base._OnInit();
|
|
|
|
|
|
|
|
|
|
|
|
var units = AreaManager.instance.GetUnitsByCellIndex(owner.selectedCellIndex);
|
|
|
|
|
|
GameUnit selectUnit = null;
|
|
|
|
|
|
for (int i = 0; i < units.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var unit = units[i];
|
|
|
|
|
|
if (unit.commonData.troopId == owner.playerUnit.commonData.troopId)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 友军不生效
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-06-24 15:15:43 +08:00
|
|
|
|
if (unit.gameunitType != EGameUnitType.Character
|
2024-07-05 18:53:02 +08:00
|
|
|
|
&& unit.gameunitType != EGameUnitType.Vehicle)
|
2023-12-13 14:58:11 +08:00
|
|
|
|
{
|
2024-06-24 15:15:43 +08:00
|
|
|
|
// 只对角色和载具生效
|
2023-12-13 14:58:11 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
selectUnit = unit;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (selectUnit != null)
|
|
|
|
|
|
{
|
2023-12-14 18:25:52 +08:00
|
|
|
|
var allUnits = GameUnitManager.instance.infightUnits;
|
|
|
|
|
|
for (int i = 0; i < allUnits.count; i++)
|
2023-12-13 14:58:11 +08:00
|
|
|
|
{
|
2023-12-14 18:25:52 +08:00
|
|
|
|
var unit = allUnits.GetByIndex(i);
|
2023-12-13 14:58:11 +08:00
|
|
|
|
if (unit.commonData.troopId != owner.playerUnit.commonData.troopId)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 只筛选友军
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-06-24 15:15:43 +08:00
|
|
|
|
if (unit.gameunitType != EGameUnitType.Character
|
2024-07-05 18:53:02 +08:00
|
|
|
|
&& unit.gameunitType != EGameUnitType.Vehicle)
|
2023-12-13 14:58:11 +08:00
|
|
|
|
{
|
2024-06-24 15:15:43 +08:00
|
|
|
|
// 只对角色和载具生效
|
2023-12-13 14:58:11 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-06-24 15:15:43 +08:00
|
|
|
|
unit.MoveTo(selectUnit);
|
2023-12-13 14:58:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-24 15:11:43 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var allUnits = GameUnitManager.instance.infightUnits;
|
|
|
|
|
|
for (int i = 0; i < allUnits.count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var unit = allUnits.GetByIndex(i);
|
|
|
|
|
|
if (unit.commonData.troopId != owner.playerUnit.commonData.troopId)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 只筛选友军
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-07-05 18:53:02 +08:00
|
|
|
|
if (unit.gameunitType != EGameUnitType.Character
|
|
|
|
|
|
&& unit.gameunitType != EGameUnitType.Vehicle)
|
2024-06-24 15:11:43 +08:00
|
|
|
|
{
|
2024-07-05 18:53:02 +08:00
|
|
|
|
// 只对角色和载具生效
|
2024-06-24 15:11:43 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-07-08 12:55:58 +08:00
|
|
|
|
unit.MoveTo(owner.selectedCellIndex, true);
|
2024-06-24 15:11:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-13 14:58:11 +08:00
|
|
|
|
|
|
|
|
|
|
isFinished = true;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|