狐狸大招碰撞解决
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
||||
|
||||
@ -8,6 +8,13 @@ end
|
||||
function LevelFoxRole:ReceiveBeginPlay()
|
||||
self["SpineAnimationComponent"]:SetAnimation(0, "Idle/Front", true)
|
||||
self.last_animation = "Idle/Front"
|
||||
|
||||
self["SpineBoneFollower"].Target = self
|
||||
self["SpineBoneFollower"].BoneName = "tail"
|
||||
self["SpineBoneFollower"].UseComponentTransform = true
|
||||
self["SpineBoneFollower"].UseScale = true
|
||||
|
||||
self["TailCollision"]:SetCollisionEnabled(0)
|
||||
end
|
||||
|
||||
|
||||
@ -42,32 +49,6 @@ function LevelFoxRole:OnMove(location)
|
||||
self["MovementComponent"]:MoveTo(location)
|
||||
end
|
||||
|
||||
function LevelFoxRole:OnUltimateSkill()
|
||||
print("LevelFoxRole:OnUltimateSkill")
|
||||
local sprint_distance = 600
|
||||
local sprint_speed_rate = 3.8
|
||||
|
||||
-- 获取角色朝向
|
||||
local forward_direction = self["MovementComponent"]:GetForwardDirection()
|
||||
|
||||
self["MovementComponent"]:SprintTo(sprint_distance, sprint_speed_rate)
|
||||
|
||||
|
||||
local anim_comp = self["SpineAnimationComponent"]
|
||||
if forward_direction.X >= 0 then
|
||||
anim_comp:SetAnimation(0, "Ultimate/Right/UltimateStage1", false)
|
||||
else
|
||||
anim_comp:SetAnimation(0, "Ultimate/Left/UltimateStage1", false)
|
||||
end
|
||||
local anim_entry = anim_comp:GetCurrent(0)
|
||||
|
||||
local anim_total_time = anim_entry:GetAnimationEnd()
|
||||
local sprint_time = sprint_distance / (self:GetSpeed() * sprint_speed_rate)
|
||||
|
||||
anim_comp:SetTimeScale(anim_total_time / sprint_time)
|
||||
|
||||
print("hahhh", anim_total_time, sprint_time)
|
||||
end
|
||||
|
||||
|
||||
return Class(nil, nil, LevelFoxRole)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,7 +16,6 @@ ABusyPawnBase::ABusyPawnBase()
|
||||
|
||||
RootScene = CreateDefaultSubobject<USceneComponent>(TEXT("RootScene"));
|
||||
SpineRoot = CreateDefaultSubobject<USceneComponent>(TEXT("SpineRoot"));
|
||||
SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
|
||||
SpineRenderComponent = CreateDefaultSubobject<USpineSkeletonRendererComponent>(TEXT("SpineRenderComponent"));
|
||||
SpineAnimationComponent = CreateDefaultSubobject<USpineSkeletonAnimationComponent>(TEXT("SpineAnimationComponent"));
|
||||
AbilitySystemComponent = CreateDefaultSubobject<UBusyAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
|
||||
@ -24,7 +23,6 @@ ABusyPawnBase::ABusyPawnBase()
|
||||
|
||||
RootComponent = RootScene;
|
||||
SpineRoot->SetupAttachment(RootScene);
|
||||
SphereComponent->SetupAttachment(SpineRoot);
|
||||
SpineRenderComponent->SetupAttachment(SpineRoot);
|
||||
|
||||
SpineRoot->SetRelativeRotation(FRotator(0, 0, -90));
|
||||
|
||||
@ -5,13 +5,11 @@
|
||||
#include "BusyPawnBase.generated.h"
|
||||
|
||||
struct FBusyPawnBaseConfig;
|
||||
class USphereComponent;
|
||||
class USpineBoneFollowerComponent;
|
||||
class USpineSkeletonRendererComponent;
|
||||
class USpineSkeletonAnimationComponent;
|
||||
class UBusyPawnMovementComponent;
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value);
|
||||
|
||||
|
||||
@ -81,12 +79,6 @@ protected:
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
TObjectPtr<USceneComponent> RootScene; //场景根组件
|
||||
|
||||
/*-----------------------------碰撞相关组件-----------------------------*/
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
TObjectPtr<USphereComponent> SphereComponent;
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------spine相关组件----------------------------*/
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
TObjectPtr<USceneComponent> SpineRoot;
|
||||
|
||||
Reference in New Issue
Block a user