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.
44 lines
1.6 KiB
44 lines
1.6 KiB
using System;
|
|
using CoreGame;
|
|
using CoreGame.Render;
|
|
using Sirenix.OdinInspector;
|
|
|
|
namespace GAS.Runtime
|
|
{
|
|
[Serializable]
|
|
public class OverflowTriggerAbilityGEComponet : GameplayEffectComponent
|
|
{
|
|
[LabelText("触发的技能ID")]
|
|
public int cfgId;
|
|
|
|
[LabelText("为附加来源添加GA")]
|
|
public bool isSrc;
|
|
[ShowInInspector]
|
|
[HideReferenceObjectPicker]
|
|
[ShowIf("m_Cfg")]
|
|
private SkillDesc m_Cfg => SkillDescMgr.Instance.GetConfig(cfgId);
|
|
public override void OnOverflowGameplayEffectStack(GameplayEffectComponentSpec partSelf, GameplayEffectSpec GESpec, int maxStackCount)
|
|
{
|
|
GameAbilityContext attachActiveAbility = null;
|
|
var combatEntity = GESpec.Owner.owner;
|
|
if (isSrc)
|
|
{
|
|
attachActiveAbility = AbilitySrv.GrantTransferAbility(GESpec.Source.owner, cfgId, GESpec.effectParams.gaInitCfg);
|
|
}
|
|
else
|
|
{
|
|
attachActiveAbility = AbilitySrv.GrantTransferAbility(combatEntity, cfgId, GESpec.effectParams.gaInitCfg, GESpec.Source.owner);
|
|
}
|
|
|
|
if (attachActiveAbility != null)
|
|
{
|
|
attachActiveAbility.attackCarrierEid = combatEntity.creationIndex;
|
|
attachActiveAbility.castTarget.Add(combatEntity.creationIndex);
|
|
attachActiveAbility.castPos.Add(combatEntity.logicTransform.position);
|
|
|
|
attachActiveAbility.dropAbilityWhenEnd = true;
|
|
attachActiveAbility.asc.TryActivateAbility_WithSeq(attachActiveAbility.gaSeq);
|
|
}
|
|
}
|
|
}
|
|
}
|