154 lines
5.2 KiB
C++
154 lines
5.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
||
|
||
#pragma once
|
||
|
||
#include "CoreMinimal.h"
|
||
#include "AbilitySystemInterface.h"
|
||
#include "GameFramework/Character.h"
|
||
#include "GameplayEffect.h"
|
||
#include "InputActionValue.h"
|
||
#include "TG_ARPGCharacter.generated.h"
|
||
|
||
|
||
class UTGAbilitySystemComponent;
|
||
class UTGAttributeSet;
|
||
|
||
UCLASS()
|
||
class ATG_ARPGCharacter : public ACharacter , public IAbilitySystemInterface
|
||
{
|
||
GENERATED_BODY()
|
||
|
||
/** Camera boom positioning the camera behind the character */
|
||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
||
class USpringArmComponent* CameraBoom;
|
||
|
||
/** Follow camera */
|
||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
||
class UCameraComponent* FollowCamera;
|
||
|
||
/** MappingContext */
|
||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||
class UInputMappingContext* DefaultMappingContext;
|
||
|
||
/** Jump Input Action */
|
||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||
class UInputAction* JumpAction;
|
||
|
||
/** Move Input Action */
|
||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||
class UInputAction* MoveAction;
|
||
|
||
/** Look Input Action */
|
||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||
class UInputAction* LookAction;
|
||
|
||
public:
|
||
ATG_ARPGCharacter();
|
||
|
||
|
||
protected:
|
||
|
||
/** Called for movement input */
|
||
void Move(const FInputActionValue& Value);
|
||
|
||
/** Called for looking input */
|
||
void Look(const FInputActionValue& Value);
|
||
|
||
|
||
// APawn interface
|
||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||
|
||
// To add mapping context
|
||
virtual void BeginPlay();
|
||
|
||
public:
|
||
virtual void Tick(float DeltaTime) override;
|
||
/** Returns CameraBoom subobject **/
|
||
FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
|
||
/** Returns FollowCamera subobject **/
|
||
FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
||
|
||
|
||
//加载ASC component
|
||
UPROPERTY(VisibleAnywhere,BlueprintReadOnly,Category = "GAS")
|
||
class UTGAbilitySystemComponent* AbilitySystemComponent;
|
||
//添加ASC数值
|
||
UPROPERTY(VisibleAnywhere,BlueprintReadOnly,Category = "GAS")
|
||
const class UTGAttributeSet* AttributeSet;
|
||
//初始化数值
|
||
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category ="GAS")
|
||
TArray<TSubclassOf<class UGameplayAbility>> InitialAbilites;
|
||
|
||
//接口函数
|
||
virtual class UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||
|
||
//定义函数
|
||
UFUNCTION()
|
||
virtual void OnHealthChangeNative(float health,int32 stackCount);
|
||
UFUNCTION()
|
||
virtual void OnManaChangedNative(float mana,int32 stackCount);
|
||
UFUNCTION()
|
||
virtual void OnAttackDamageChangeNative(float attackDamage,int32 stackCount);
|
||
UFUNCTION()
|
||
virtual void OnSpeedMultiplierChangedNative(float speedMultiplier,int32 stackCount);
|
||
|
||
|
||
UFUNCTION(BlueprintImplementableEvent,Category = "Gas")
|
||
void OnHealthChange(float health,int32 stackCount);
|
||
UFUNCTION(BlueprintImplementableEvent,Category = "Gas")
|
||
void OnManaChanged(float mana,int32 stackCount);
|
||
UFUNCTION(BlueprintImplementableEvent,Category = "Gas")
|
||
void OnAttackDamageChange(float attackDamage,int32 stackCount);
|
||
UFUNCTION(BlueprintImplementableEvent,Category = "Gas")
|
||
void OnSpeedMultiplierChanged(float speedMultiplier,int32 stackCount);
|
||
|
||
//初始化ASC
|
||
UFUNCTION(BlueprintCallable,Category = "GAS")
|
||
void InitializeAbility(TSubclassOf<UGameplayAbility> abilityToGet,int32 abilityLevel);
|
||
|
||
UFUNCTION(BlueprintCallable,Category = "GAS")
|
||
void InitializeAbilities(TArray<TSubclassOf<UGameplayAbility>> abilitiesToGet,int32 abilityLevel);
|
||
|
||
//通过Tag删除指定Ability
|
||
UFUNCTION(BlueprintCallable,Category = "GAS")
|
||
void RemoveAbilityWithTags(FGameplayTagContainer tagContainer);
|
||
|
||
//通过Tag升级Ability信息
|
||
UFUNCTION(BlueprintCallable,Category = "GAS")
|
||
void ChangeAbilityLevelWithTags(FGameplayTagContainer tagContainer,int32 newLevel);
|
||
|
||
//通过Tag打断Ability释放效果
|
||
UFUNCTION(BlueprintCallable,Category = "GAS")
|
||
void CancelAbilityWithTags(FGameplayTagContainer withTags,FGameplayTagContainer withoutTags);
|
||
|
||
//Server初始化角色控制权
|
||
virtual void PossessedBy(AController* NewController) override;
|
||
//Client初始化角色控制权
|
||
virtual void OnRep_PlayerState() override;
|
||
|
||
|
||
//从GAS中获取属性值,设定蓝图调用函数;
|
||
UFUNCTION(BlueprintPure,Category = "GAS")
|
||
void GetCurrentHealthValues(float& CurrentHealth,float& maxHealth);
|
||
UFUNCTION(BlueprintPure,Category = "GAS")
|
||
void GetCurrentManaValues(float& CurrentMana,float& maxMana);
|
||
UFUNCTION(BlueprintPure,Category = "GAS")
|
||
void GetCurrentAttackDamageValues(float& currentAttackDamage);
|
||
UFUNCTION(BlueprintPure,Category = "GAS")
|
||
void GetCurrentSpeedMultiplierValues(float& currentSpeedMultiplier);
|
||
|
||
|
||
//附加仅本地使用的LooseGameplayTags(网络不同步),且手动管理;
|
||
//通过一下函数调用在蓝图中管理LooseGamplayTags的数组TagMapCount;
|
||
UFUNCTION(BlueprintCallable, Category = "GAS")
|
||
void AddLooseGameplayTag(FGameplayTag tagToAdd);
|
||
UFUNCTION(BlueprintCallable, Category = "GAS")
|
||
void RemoveLooseGameplayTag(FGameplayTag tagToRemove);
|
||
|
||
|
||
|
||
|
||
|
||
};
|
||
|