狐狸大招碰撞解决

This commit is contained in:
2025-10-19 03:33:01 +08:00
parent ddde270ad5
commit 1e04c04600
9 changed files with 25 additions and 38 deletions

View File

@ -12,6 +12,7 @@ function FoxUltimate:ctor()
self.active_recast_handle = nil
self.active_accelerate_handle = nil
self.overlap_delegate_handle = nil
self.tag_add_or_remove_delegate = nil
end
@ -28,6 +29,8 @@ function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
self.animation = owner.SpineAnimationComponent
self.asc = AbilitySystemBlueprintLibrary.GetAbilitySystemComponent(owner)
self.recast_tag = BusyGameplayLibrary.RequestGameplayTag("Ability.Flags.Recast")
self.owner = owner
local asc = self.asc
@ -58,8 +61,6 @@ function FoxUltimate:TriggerUltimate(asc)
elseif self.ultimate_phase == 2 then
-- 第二次激活移除可重复释放的tag
self.asc:RemoveActiveGameplayEffect(self.active_recast_handle, -1)
local _, recast_effect = self:GetAbilityEffectSpecHandle("Recast", asc, 1, nil)
self.active_recast_handle = asc:BP_ApplyGameplayEffectSpecToSelf(recast_effect)
elseif self.ultimate_phase == 3 then
self.asc:RemoveActiveGameplayEffect(self.active_recast_handle, -1)
end
@ -172,6 +173,21 @@ function FoxUltimate:OnAnimationEvent(entry, event)
self.active_accelerate_handle = self:MakeAccelerate(8.0, 0.5)
elseif event.Name == "OnSpeedReset" then
self.asc:RemoveActiveGameplayEffect(self.active_accelerate_handle, -1)
elseif event.Name == "OnDamageBegin" then
local collision = self.owner["TailCollision"]
collision:SetCollisionEnabled(1)
self.overlap_delegate_handle = collision.OnComponentBeginOverlap:Add(function()
if not self.asc:HasMatchingGameplayTag(self.recast_tag) then
local _, recast_effect = self:GetAbilityEffectSpecHandle("Recast", self.asc, 1, nil)
self.active_recast_handle = self.asc:BP_ApplyGameplayEffectSpecToSelf(recast_effect)
end
end)
elseif event.Name == "OnDamageEnd" then
self.owner["TailCollision"]:SetCollisionEnabled(0)
if self.overlap_delegate_handle ~= nil then
self.owner["TailCollision"].OnComponentBeginOverlap:Remove(self.overlap_delegate_handle)
self.overlap_delegate_handle = nil
end
end
end