狐狸大招碰撞解决
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_recast_handle = nil
|
||||||
self.active_accelerate_handle = nil
|
self.active_accelerate_handle = nil
|
||||||
|
|
||||||
|
self.overlap_delegate_handle = nil
|
||||||
self.tag_add_or_remove_delegate = nil
|
self.tag_add_or_remove_delegate = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
|
|||||||
self.animation = owner.SpineAnimationComponent
|
self.animation = owner.SpineAnimationComponent
|
||||||
self.asc = AbilitySystemBlueprintLibrary.GetAbilitySystemComponent(owner)
|
self.asc = AbilitySystemBlueprintLibrary.GetAbilitySystemComponent(owner)
|
||||||
self.recast_tag = BusyGameplayLibrary.RequestGameplayTag("Ability.Flags.Recast")
|
self.recast_tag = BusyGameplayLibrary.RequestGameplayTag("Ability.Flags.Recast")
|
||||||
|
self.owner = owner
|
||||||
|
|
||||||
|
|
||||||
local asc = self.asc
|
local asc = self.asc
|
||||||
|
|
||||||
@ -58,8 +61,6 @@ function FoxUltimate:TriggerUltimate(asc)
|
|||||||
elseif self.ultimate_phase == 2 then
|
elseif self.ultimate_phase == 2 then
|
||||||
-- 第二次激活,移除可重复释放的tag
|
-- 第二次激活,移除可重复释放的tag
|
||||||
self.asc:RemoveActiveGameplayEffect(self.active_recast_handle, -1)
|
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
|
elseif self.ultimate_phase == 3 then
|
||||||
self.asc:RemoveActiveGameplayEffect(self.active_recast_handle, -1)
|
self.asc:RemoveActiveGameplayEffect(self.active_recast_handle, -1)
|
||||||
end
|
end
|
||||||
@ -172,6 +173,21 @@ function FoxUltimate:OnAnimationEvent(entry, event)
|
|||||||
self.active_accelerate_handle = self:MakeAccelerate(8.0, 0.5)
|
self.active_accelerate_handle = self:MakeAccelerate(8.0, 0.5)
|
||||||
elseif event.Name == "OnSpeedReset" then
|
elseif event.Name == "OnSpeedReset" then
|
||||||
self.asc:RemoveActiveGameplayEffect(self.active_accelerate_handle, -1)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,13 @@ end
|
|||||||
function LevelFoxRole:ReceiveBeginPlay()
|
function LevelFoxRole:ReceiveBeginPlay()
|
||||||
self["SpineAnimationComponent"]:SetAnimation(0, "Idle/Front", true)
|
self["SpineAnimationComponent"]:SetAnimation(0, "Idle/Front", true)
|
||||||
self.last_animation = "Idle/Front"
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -42,32 +49,6 @@ function LevelFoxRole:OnMove(location)
|
|||||||
self["MovementComponent"]:MoveTo(location)
|
self["MovementComponent"]:MoveTo(location)
|
||||||
end
|
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)
|
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"));
|
RootScene = CreateDefaultSubobject<USceneComponent>(TEXT("RootScene"));
|
||||||
SpineRoot = CreateDefaultSubobject<USceneComponent>(TEXT("SpineRoot"));
|
SpineRoot = CreateDefaultSubobject<USceneComponent>(TEXT("SpineRoot"));
|
||||||
SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
|
|
||||||
SpineRenderComponent = CreateDefaultSubobject<USpineSkeletonRendererComponent>(TEXT("SpineRenderComponent"));
|
SpineRenderComponent = CreateDefaultSubobject<USpineSkeletonRendererComponent>(TEXT("SpineRenderComponent"));
|
||||||
SpineAnimationComponent = CreateDefaultSubobject<USpineSkeletonAnimationComponent>(TEXT("SpineAnimationComponent"));
|
SpineAnimationComponent = CreateDefaultSubobject<USpineSkeletonAnimationComponent>(TEXT("SpineAnimationComponent"));
|
||||||
AbilitySystemComponent = CreateDefaultSubobject<UBusyAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
|
AbilitySystemComponent = CreateDefaultSubobject<UBusyAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
|
||||||
@ -24,7 +23,6 @@ ABusyPawnBase::ABusyPawnBase()
|
|||||||
|
|
||||||
RootComponent = RootScene;
|
RootComponent = RootScene;
|
||||||
SpineRoot->SetupAttachment(RootScene);
|
SpineRoot->SetupAttachment(RootScene);
|
||||||
SphereComponent->SetupAttachment(SpineRoot);
|
|
||||||
SpineRenderComponent->SetupAttachment(SpineRoot);
|
SpineRenderComponent->SetupAttachment(SpineRoot);
|
||||||
|
|
||||||
SpineRoot->SetRelativeRotation(FRotator(0, 0, -90));
|
SpineRoot->SetRelativeRotation(FRotator(0, 0, -90));
|
||||||
|
|||||||
@ -5,13 +5,11 @@
|
|||||||
#include "BusyPawnBase.generated.h"
|
#include "BusyPawnBase.generated.h"
|
||||||
|
|
||||||
struct FBusyPawnBaseConfig;
|
struct FBusyPawnBaseConfig;
|
||||||
class USphereComponent;
|
|
||||||
class USpineBoneFollowerComponent;
|
class USpineBoneFollowerComponent;
|
||||||
class USpineSkeletonRendererComponent;
|
class USpineSkeletonRendererComponent;
|
||||||
class USpineSkeletonAnimationComponent;
|
class USpineSkeletonAnimationComponent;
|
||||||
class UBusyPawnMovementComponent;
|
class UBusyPawnMovementComponent;
|
||||||
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value);
|
DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value);
|
||||||
|
|
||||||
|
|
||||||
@ -81,12 +79,6 @@ protected:
|
|||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
TObjectPtr<USceneComponent> RootScene; //场景根组件
|
TObjectPtr<USceneComponent> RootScene; //场景根组件
|
||||||
|
|
||||||
/*-----------------------------碰撞相关组件-----------------------------*/
|
|
||||||
UPROPERTY(EditDefaultsOnly)
|
|
||||||
TObjectPtr<USphereComponent> SphereComponent;
|
|
||||||
/*-------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------spine相关组件----------------------------*/
|
/*----------------------------spine相关组件----------------------------*/
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
TObjectPtr<USceneComponent> SpineRoot;
|
TObjectPtr<USceneComponent> SpineRoot;
|
||||||
|
|||||||
Reference in New Issue
Block a user