Advertisement
Guest User

GASCharacter.h

a guest
Mar 11th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.24 KB | None | 0 0
  1. // Copyright Epic Games, Inc. All Rights Reserved.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "GameFramework/Character.h"
  7. #include "AbilitySystemInterface.h"
  8. #include <GameplayEffectTypes.h>
  9. #include "GASAbilitySystemComponent.h"
  10. #include "GASAttributeSet.h"
  11. #include "GASCharacter.generated.h"
  12.  
  13. UCLASS(config=Game)
  14. class AGASCharacter : public ACharacter, public IAbilitySystemInterface
  15. {
  16.     GENERATED_BODY()
  17.  
  18.     /** Camera boom positioning the camera behind the character */
  19.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  20.     class USpringArmComponent* CameraBoom;
  21.  
  22.     /** Follow camera */
  23.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  24.     class UCameraComponent* FollowCamera;
  25.  
  26.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  27.     class UGASAbilitySystemComponent* AbilitySystemComponent;
  28.  
  29.     UPROPERTY()
  30.     class UGASAttributeSet* Attributes;
  31.  
  32. public:
  33.     AGASCharacter();
  34.  
  35.     /** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
  36.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
  37.     float BaseTurnRate;
  38.  
  39.     /** Base look up/down rate, in deg/sec. Other scaling may affect final rate. */
  40.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
  41.     float BaseLookUpRate;
  42.  
  43.     virtual class UAbilitySystemComponent* GetAbilitySystemComponent() const override;
  44.  
  45.     virtual void InitializeAttributes();
  46.     virtual void GiveAbilities();
  47.  
  48.     virtual void PossessedBy(AController* NewController) override;
  49.     virtual void OnRep_PlayerState() override;
  50.  
  51.     /**Effect that initialises our default attributes. */
  52.     UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "GAS")
  53.     TSubclassOf<class UGameplayEffect> DefaultAttributeEffect;
  54.  
  55.     /**Effect that initialises our default attributes. */
  56.     UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "GAS")
  57.         TArray<TSubclassOf<class UGASGameplayAbility>> DefaultAbilities;
  58.  
  59. protected:
  60.  
  61.     /** Resets HMD orientation in VR. */
  62.     void OnResetVR();
  63.  
  64.     /** Called for forwards/backward input */
  65.     void MoveForward(float Value);
  66.  
  67.     /** Called for side to side input */
  68.     void MoveRight(float Value);
  69.  
  70.     /**
  71.      * Called via input to turn at a given rate.
  72.      * @param Rate  This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
  73.      */
  74.     void TurnAtRate(float Rate);
  75.  
  76.     /**
  77.      * Called via input to turn look up/down at a given rate.
  78.      * @param Rate  This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
  79.      */
  80.     void LookUpAtRate(float Rate);
  81.  
  82.     /** Handler for when a touch input begins. */
  83.     void TouchStarted(ETouchIndex::Type FingerIndex, FVector Location);
  84.  
  85.     /** Handler for when a touch input stops. */
  86.     void TouchStopped(ETouchIndex::Type FingerIndex, FVector Location);
  87.  
  88. protected:
  89.     // APawn interface
  90.     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
  91.     // End of APawn interface
  92.  
  93. public:
  94.     /** Returns CameraBoom subobject **/
  95.     FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
  96.     /** Returns FollowCamera subobject **/
  97.     FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
  98. };
  99.  
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement