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.
43 lines
1.4 KiB
43 lines
1.4 KiB
using BehaviorDesigner.Runtime.Tasks;
|
|
using GAS.Runtime;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public class TryCastSkillAction : Action
|
|
{
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
var ownerEnt = Owner.GetEntity<CombatEntity>();
|
|
var ac = ownerEnt.aI;
|
|
|
|
ac.abilitySeq = 0;
|
|
var ass = ownerEnt.abilitySystem.AbilityContainer.QueryAbilitySpecArray;
|
|
// 循环遍历所有的ability 轨道,指导普攻
|
|
var assCount = ass.Count;
|
|
for (var index = 0; index < assCount; index++)
|
|
{
|
|
var ability = ass[index];
|
|
if (ability.Ability.Tag.AssetTag.HasTag(GTagLib.Solt_Active))
|
|
{
|
|
if (ability.CanActivate() == AbilityActivateResult.Success)
|
|
{
|
|
ac.abilitySeq = ability.ctx.gaSeq;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// TraceLog.Debug("abilitySeq: "+ac.abilitySeq);
|
|
if (ac.abilitySeq == 0)
|
|
{
|
|
if (ownerEnt.abilitySystem.HasAbilityProcess(GTagLib.Solt_Active))
|
|
return TaskStatus.Success;
|
|
|
|
return TaskStatus.Failure;
|
|
}
|
|
ownerEnt.abilitySystem.TryActivateAbility_WithSeq(ac.abilitySeq);
|
|
BlackboardSrv.SetAttackCount(ownerEnt.creationIndex);
|
|
return TaskStatus.Success;
|
|
}
|
|
}
|
|
}
|