You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.4 KiB
68 lines
2.4 KiB
using System.Collections.Generic;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
using GAS.Runtime;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public class FindEnemyCondition : Conditional
|
|
{
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
var ownerEnt = Owner.GetEntity<CombatEntity>();
|
|
var ac = ownerEnt.aI;
|
|
if (ownerEnt.abilitySystem.HasAbilityProcess(GTagLib.Solt_Active))
|
|
return TaskStatus.Failure;
|
|
AbilitySpec aga = null;
|
|
|
|
var ass = ownerEnt.abilitySystem.AbilityContainer.QueryAbilitySpecArray;
|
|
// 循环遍历所有的ability 轨道,指导普攻
|
|
for (var index = 0; index < ass.Count; index++)
|
|
{
|
|
aga = ass[index];
|
|
if (aga.Ability.Tag.AssetTag.HasTag(GTagLib.Solt_Active))
|
|
{
|
|
if (aga.CanActivate() == AbilityActivateResult.Success)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
ac.abilitySeq = 0;
|
|
do
|
|
{
|
|
if (aga != null && aga.CanActivate() == AbilityActivateResult.Success)
|
|
{
|
|
ac.abilitySeq = aga.ctx.gaSeq;
|
|
if (true)
|
|
{
|
|
// var calcVal = ExpressionEvaluator.CalcVal(aga.ctx.abilityCfg.SkillDistance, aga.ctx, 10);
|
|
var calcVal = 10;
|
|
var combatEntities = ListPool<CombatEntity>.Pop();
|
|
TargetSelectSrv.SelectDistanceEnts(ownerEnt, calcVal, combatEntities);
|
|
ac.targetList.Clear();
|
|
for (var index = 0; index < combatEntities.Count; index++)
|
|
{
|
|
ac.targetList.Add(combatEntities[index].creationIndex);
|
|
}
|
|
ListPool<CombatEntity>.Push(ref combatEntities);
|
|
|
|
if (ac.targetList.Count > 0 )
|
|
break;
|
|
}
|
|
}
|
|
|
|
TargetSelectSrv.DoAITargetSelect(EffectTargetType.NearEntity, ac.targetList,
|
|
null, ownerEnt);
|
|
break;
|
|
}
|
|
while (true);
|
|
|
|
if (ac.targetList.Count < 1)
|
|
return TaskStatus.Failure;
|
|
|
|
return TaskStatus.Success;
|
|
}
|
|
}
|
|
}
|