198 lines
6.8 KiB
C++
198 lines
6.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "InputActionValue.h"
|
|
#include "AbilitySystemInterface.h" //allows defining an interface for ability system
|
|
#include "GameplayEffectTypes.h"
|
|
#include "GameplayTagContainer.h"
|
|
#include "hwanyoung2.h"
|
|
#include "hwanyoung2Character.generated.h"
|
|
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCharacterDiedDelegate,
|
|
Ahwanyoung2Character*, Character);
|
|
|
|
UCLASS(config=Game)
|
|
class Ahwanyoung2Character : 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;
|
|
|
|
/** Collection sphere */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
|
class USphereComponent* CollectionSphere;
|
|
|
|
#pragma region Character Gameplay Input Action
|
|
/** 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;
|
|
|
|
#pragma endregion
|
|
|
|
private:
|
|
//Helper function for
|
|
void Initialize();
|
|
|
|
public:
|
|
UPROPERTY(BlueprintAssignable, Category = "Hwanyoung|Character")
|
|
FCharacterDiedDelegate OnCharacterDied;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
|
|
virtual bool IsAlive() const;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
|
|
virtual int32 GetAbilityLevel(EAbilityInputID AbilityID) const;
|
|
|
|
////this function is called only in the server:
|
|
//virtual void RemoveCharacterAbilities();
|
|
////this is also called only in the server:
|
|
//virtual void Die();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Character")
|
|
virtual void FinishDying();
|
|
|
|
//attribute getter functions
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
|
|
float GetPlayerLevel() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
|
|
float GetHealth() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
|
|
float GetMaxHealth() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
|
|
float GetMana() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
|
|
float GetMaxMana() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
|
|
float GetStamina() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
|
|
float GetMaxStamina() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Attributes")
|
|
float GetGaugeP() const;
|
|
UFUNCTION(BlueprintCallable, Category = "Hwanyoung|Atributes")
|
|
float GetMaxGaugeP() const;
|
|
|
|
Ahwanyoung2Character();
|
|
Ahwanyoung2Character(const class FObjectInitializer& ObjectInitializer);
|
|
|
|
//Updates the AbilitysystemComponent's actorInfo, especially in a multiplayer environment
|
|
//Gets called on the server (so basically my end)
|
|
virtual void PossessedBy(AController* NewController) override;
|
|
//Gets called on the client (their end)
|
|
virtual void OnRep_PlayerState() override;
|
|
|
|
//getter function for ability system component:
|
|
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
|
|
float GetStartingCameraBoomArmLength();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
|
|
FVector GetStartingCameraBoomLocation();
|
|
|
|
/** Returns CameraBoom subobject **/
|
|
class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
|
|
/** Returns FollowCamera subobject **/
|
|
class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
|
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
protected:
|
|
|
|
//pointers to the attribute set and ability system component
|
|
//of the player character
|
|
/** Our ability system */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Abilities, meta = (AllowPrivateAccess = "true"))
|
|
TWeakObjectPtr<class UHYCharacAbilitySystemComponent> AbilitySystemComponent;
|
|
|
|
UPROPERTY()
|
|
TWeakObjectPtr<class UHYPlayerCharacAttributeSet> AttributeSetBase;
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
|
|
float StartingCameraBoomArmLength;
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
|
|
FVector StartingCameraBoomLocation;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "HY_Character|Camera")
|
|
float BaseTurnRate = 45.0f;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "HY_Character|Camera")
|
|
float BaseLookUpRate = 45.0f;
|
|
|
|
//gameplaytags represent the states of the object;
|
|
//so if we were to modify the gameplay tags of a character,
|
|
//we are, comprehensively speaking, changing the states of
|
|
//the given character
|
|
FGameplayTag DeadTag;
|
|
FGameplayTag EffectRemoveOnDeathTag;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Character")
|
|
FText CharacterName;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Hwanyoung|Animation")
|
|
UAnimMontage* DeathMontage;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilties")
|
|
TSubclassOf<class UGameplayEffect> DefaultAttributes;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilities")
|
|
TArray<TSubclassOf<class UGameplayEffect>> StartupEffects;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Abilities")
|
|
TArray<TSubclassOf<class UHYCharacGameplayAbility>> CharacterAbilities;
|
|
|
|
virtual void AddCharacterAbilities();
|
|
virtual void InitializeAttributes();
|
|
virtual void AddStartupEffects();
|
|
|
|
//these two functions are going to be used
|
|
//when re/spawn; changes to these attributes mid-gameplay
|
|
//are going to be calculated via GameplayEffects
|
|
virtual void SetHealth(float Health);
|
|
virtual void SetMana(float Mana);
|
|
virtual void SetStamina(float Stamina);
|
|
virtual void SetGaugeP(float GaugeP);
|
|
|
|
/** Called for movement input */
|
|
void Move(const FInputActionValue& Value);
|
|
|
|
/** Called for looking input */
|
|
void Look(const FInputActionValue& Value);
|
|
|
|
/** Called for checking for the closest Interactable in sight and in range*/
|
|
void CheckForInteractables();
|
|
|
|
|
|
protected:
|
|
// APawn interface
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
|
|
// To add mapping context
|
|
virtual void BeginPlay();
|
|
|
|
|
|
};
|
|
|