解决了狐狸大招冷却和消耗的问题
This commit is contained in:
@ -9,6 +9,7 @@ InvalidTagCharacters="\"\',"
|
|||||||
NumBitsForContainerSize=6
|
NumBitsForContainerSize=6
|
||||||
NetIndexFirstBitSegment=16
|
NetIndexFirstBitSegment=16
|
||||||
+GameplayTagList=(Tag="Ability.Block.UltimatePlaying",DevComment="大招正在释放中")
|
+GameplayTagList=(Tag="Ability.Block.UltimatePlaying",DevComment="大招正在释放中")
|
||||||
|
+GameplayTagList=(Tag="Ability.Flags.Cooldown",DevComment="技能冷却")
|
||||||
+GameplayTagList=(Tag="Ability.Flags.Recast",DevComment="可以再次释放技能的标记")
|
+GameplayTagList=(Tag="Ability.Flags.Recast",DevComment="可以再次释放技能的标记")
|
||||||
+GameplayTagList=(Tag="Ability.Role.AttributeConsume",DevComment="角色属性损耗debuff")
|
+GameplayTagList=(Tag="Ability.Role.AttributeConsume",DevComment="角色属性损耗debuff")
|
||||||
+GameplayTagList=(Tag="Ability.Role.EatFood",DevComment="干饭")
|
+GameplayTagList=(Tag="Ability.Role.EatFood",DevComment="干饭")
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset
Normal file
Binary file not shown.
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset
Normal file
BIN
Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset
Normal file
Binary file not shown.
Binary file not shown.
@ -11,12 +11,18 @@ function FoxUltimate:ctor()
|
|||||||
self.ultimate_phase = 1 -- 大招阶段
|
self.ultimate_phase = 1 -- 大招阶段
|
||||||
self.active_recast_handle = nil
|
self.active_recast_handle = nil
|
||||||
self.active_accelerate_handle = nil
|
self.active_accelerate_handle = nil
|
||||||
|
|
||||||
|
self.tag_add_or_remove_delegate = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
|
function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
|
||||||
print("FoxUltimate:K2_ActivateAbilityFromEvent", self.ultimate_phase)
|
print("FoxUltimate:K2_ActivateAbilityFromEvent", self.ultimate_phase)
|
||||||
|
|
||||||
|
if not self:K2_CommitAbilityCost(false) then
|
||||||
|
return self:K2_EndAbility()
|
||||||
|
end
|
||||||
|
|
||||||
local owner = self:GetOwningActorFromActorInfo()
|
local owner = self:GetOwningActorFromActorInfo()
|
||||||
self.movement = owner.MovementComponent
|
self.movement = owner.MovementComponent
|
||||||
self.animation = owner.SpineAnimationComponent
|
self.animation = owner.SpineAnimationComponent
|
||||||
@ -25,8 +31,17 @@ function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
|
|||||||
|
|
||||||
local asc = self.asc
|
local asc = self.asc
|
||||||
|
|
||||||
|
if self.tag_add_or_remove_delegate == nil then
|
||||||
|
self.tag_add_or_remove_delegate = slua.createDelegate(function(tag, is_add)
|
||||||
|
if is_add == 0 and not self.bIsActive then
|
||||||
|
self.ultimate_phase = 1
|
||||||
|
self:K2_CommitAbilityCooldown(false, false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
owner:BindGameplayTagAddOrRemove(self.recast_tag, self.tag_add_or_remove_delegate)
|
||||||
|
end
|
||||||
|
|
||||||
if self.ultimate_phase == 1 or asc:HasMatchingGameplayTag(self.recast_tag) then
|
if self.ultimate_phase == 1 or asc:HasMatchingGameplayTag(self.recast_tag) then
|
||||||
print("triggered")
|
|
||||||
self:TriggerUltimate(asc)
|
self:TriggerUltimate(asc)
|
||||||
else
|
else
|
||||||
self:K2_EndAbility()
|
self:K2_EndAbility()
|
||||||
@ -134,7 +149,19 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function FoxUltimate:OnAnimationComplete(entry)
|
function FoxUltimate:OnAnimationComplete(entry)
|
||||||
self.ultimate_phase = self.ultimate_phase + 1
|
local new_phase = self.ultimate_phase + 1
|
||||||
|
if new_phase > 3 then
|
||||||
|
self.ultimate_phase = 1
|
||||||
|
else
|
||||||
|
self.ultimate_phase = new_phase
|
||||||
|
end
|
||||||
|
print("FoxUltimate:OnAnimationComplete", self.ultimate_phase)
|
||||||
|
|
||||||
|
if not self.asc:HasMatchingGameplayTag(self.recast_tag) then
|
||||||
|
self.ultimate_phase = 1
|
||||||
|
self:K2_CommitAbilityCooldown(false, false)
|
||||||
|
end
|
||||||
|
|
||||||
entry.AnimationComplete:Clear()
|
entry.AnimationComplete:Clear()
|
||||||
entry.AnimationEvent:Clear()
|
entry.AnimationEvent:Clear()
|
||||||
self:K2_EndAbility()
|
self:K2_EndAbility()
|
||||||
|
|||||||
@ -1,27 +1,9 @@
|
|||||||
#include "LuaCppBinding.h"
|
#include "LuaCppBinding.h"
|
||||||
#include "AbilitySystemComponent.h"
|
|
||||||
#include "GameplayTagContainer.h"
|
|
||||||
using slua::lua_State, slua::LuaObject, slua::LuaStruct;
|
using slua::lua_State, slua::LuaObject, slua::LuaStruct;
|
||||||
using namespace slua;
|
|
||||||
|
|
||||||
|
|
||||||
#pragma optimize( "", off )
|
|
||||||
|
|
||||||
|
|
||||||
bool HasMatchingGameplayTag(const UAbilitySystemComponent& Asc, const FName& TagName)
|
|
||||||
{
|
|
||||||
// return Asc.HasMatchingGameplayTag(FGameplayTag::RequestGameplayTag(TagName));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern void RegisterAbilitySystemComponentExtension() {
|
extern void RegisterAbilitySystemComponentExtension() {
|
||||||
REG_EXTENSION_METHOD_LAMBDA(UAbilitySystemComponent, "AHasMatchingGameplayTag", false,
|
|
||||||
[](UAbilitySystemComponent* ASC, const FName& Tag) -> bool {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma optimize( "", on)
|
|
||||||
|
|
||||||
|
|||||||
@ -77,3 +77,18 @@ void ABusyPawnBase::InitPawnAbilities(const FBusyPawnBaseConfig& Config)const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABusyPawnBase::BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const
|
||||||
|
{
|
||||||
|
AbilitySystemComponent->RegisterGameplayTagEvent(Tag, EGameplayTagEventType::NewOrRemoved).AddLambda(
|
||||||
|
[Delegate](const FGameplayTag GameplayTag, const int32 Value)
|
||||||
|
{
|
||||||
|
Delegate.ExecuteIfBound(GameplayTag, Value);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ABusyPawnBase::InitCollision()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,18 +32,18 @@ void ABusyPlayerRole::InitPawnAttributes(const struct FBusyPawnBaseConfig& Confi
|
|||||||
Super::InitPawnAttributes(Config);
|
Super::InitPawnAttributes(Config);
|
||||||
UBusyPlayerRoleAttributeSet* RoleAttributes = Cast<UBusyPlayerRoleAttributeSet>(Attributes);
|
UBusyPlayerRoleAttributeSet* RoleAttributes = Cast<UBusyPlayerRoleAttributeSet>(Attributes);
|
||||||
|
|
||||||
if (RoleAttributes && Config.StaticStruct() == FBusyRoleBaseConfig::StaticStruct())
|
// if (RoleAttributes && Config.StaticStruct() == FBusyRoleBaseConfig::StaticStruct())
|
||||||
{
|
{
|
||||||
const FBusyRoleBaseConfig* RoleConfig = static_cast<const FBusyRoleBaseConfig*>(&Config);
|
const FBusyRoleBaseConfig* RoleConfig = static_cast<const FBusyRoleBaseConfig*>(&Config);
|
||||||
RoleAttributes->InitHunger(RoleConfig->Hunger);
|
RoleAttributes->InitHunger(RoleConfig->Hunger);
|
||||||
RoleAttributes->InitMaxHunger(RoleConfig->Hunger);
|
RoleAttributes->InitMaxHunger(RoleConfig->Hunger);
|
||||||
RoleAttributes->InitHungerConsume(RoleConfig->HungerConsume);
|
RoleAttributes->InitHungerConsume(RoleConfig->HungerConsume);
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"),
|
// UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"),
|
||||||
RoleAttributes, *Config.StaticStruct()->GetFName().ToString()
|
// RoleAttributes, *Config.StaticStruct()->GetFName().ToString()
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,15 +4,17 @@
|
|||||||
#include "Level/Actor/Components/BusyAbilitySystemComponent.h"
|
#include "Level/Actor/Components/BusyAbilitySystemComponent.h"
|
||||||
#include "BusyPawnBase.generated.h"
|
#include "BusyPawnBase.generated.h"
|
||||||
|
|
||||||
|
|
||||||
class USphereComponent;
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
#define MY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
|
#define MY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
|
||||||
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
|
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
|
||||||
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
|
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
|
||||||
@ -67,6 +69,13 @@ public:
|
|||||||
virtual void InitPawnAttributes(const FBusyPawnBaseConfig& Config);
|
virtual void InitPawnAttributes(const FBusyPawnBaseConfig& Config);
|
||||||
virtual void InitPawnAbilities(const FBusyPawnBaseConfig& Config) const;
|
virtual void InitPawnAbilities(const FBusyPawnBaseConfig& Config) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitCollision();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
|||||||
Reference in New Issue
Block a user