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.
 
 
 
 
 
 

37 lines
1.3 KiB

using GAS.Runtime;
namespace CoreGame.Render
{
// p1 0 增加 1 减少
public class Trigger_OnAnyCountChange : TriggerBase
{
public override void OnEvent(TriggerSpec self, int deltaCount, object param1)
{
if (deltaCount < 0 && triggerCfg.param1 == 1 // sub
||
deltaCount > 0 && triggerCfg.param1 == 0) // add
{
OnTrigger(self, 0, null);
}
}
public override void Init(TriggerSpec self)
{
self.tagChangedHandle = (tag, deltaCount) =>
{
OnEvent(self, deltaCount, null);
};
var gameplayTag = GameplayTagsManager.RequestGameplayTag(triggerCfg.strParam1);
self.owner.abilitySystem.GameplayTagCountContainer.RegisterGameplayTagEvent(gameplayTag,
EGameplayTagEventType.AnyCountChange, self.tagChangedHandle);
}
public override void UnInit(TriggerSpec self)
{
var gameplayTag = GameplayTagsManager.RequestGameplayTag(triggerCfg.strParam1);
self.owner.abilitySystem.GameplayTagCountContainer.UnregisterGameplayTagEvent(gameplayTag,
EGameplayTagEventType.AnyCountChange, self.tagChangedHandle);
}
}
}