解决了狐狸大招冷却和消耗的问题
This commit is contained in:
		| @ -1,27 +1,9 @@ | ||||
| #include "LuaCppBinding.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "GameplayTagContainer.h" | ||||
|  | ||||
| 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() { | ||||
| 	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); | ||||
| 	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); | ||||
| 		RoleAttributes->InitHunger(RoleConfig->Hunger); | ||||
| 		RoleAttributes->InitMaxHunger(RoleConfig->Hunger); | ||||
| 		RoleAttributes->InitHungerConsume(RoleConfig->HungerConsume); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"), | ||||
| 			RoleAttributes, *Config.StaticStruct()->GetFName().ToString() | ||||
| 		); | ||||
| 	} | ||||
| 	// else | ||||
| 	// { | ||||
| 	// 	UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"), | ||||
| 	// 		RoleAttributes, *Config.StaticStruct()->GetFName().ToString() | ||||
| 	// 	); | ||||
| 	// } | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -4,15 +4,17 @@ | ||||
| #include "Level/Actor/Components/BusyAbilitySystemComponent.h" | ||||
| #include "BusyPawnBase.generated.h" | ||||
|  | ||||
|  | ||||
| class USphereComponent; | ||||
| struct FBusyPawnBaseConfig; | ||||
| class USphereComponent; | ||||
| class USpineBoneFollowerComponent; | ||||
| class USpineSkeletonRendererComponent; | ||||
| class USpineSkeletonAnimationComponent; | ||||
| class UBusyPawnMovementComponent; | ||||
|  | ||||
|  | ||||
| DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value); | ||||
|  | ||||
|  | ||||
| #define MY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \ | ||||
| GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \ | ||||
| GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \ | ||||
| @ -67,6 +69,13 @@ public: | ||||
| 	virtual void InitPawnAttributes(const FBusyPawnBaseConfig& Config); | ||||
| 	virtual void InitPawnAbilities(const FBusyPawnBaseConfig& Config) const; | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const; | ||||
|  | ||||
|  | ||||
| protected: | ||||
| 	void InitCollision(); | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(EditDefaultsOnly) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user