document.write("
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DandelionCharacter.h"
#include "DandelionPlayerCharacter.generated.h"
class USpringArmComponent;
class UCameraComponent;
class UDandelionAbilitySet;
class UInputActionGameplayAbilityMappings;
/**
* Base class for Player ACharacter actors. Ensures the camera is set up correctly and that the ASC is initialized and
* correctly bound to InputActions.
*/
UCLASS()
class DANDELION_API ADandelionPlayerCharacter : public ADandelionCharacter
{
GENERATED_BODY()
#pragma region IAbilitySystemInterface
public:
/**
* Retrieves the ASC from the PlayerState associated with this ACharacter.
* @return The ASC on the PlayerState, or nullptr on failure.
*/
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
#pragma endregion
/**
* Sets up the camera's SpringArmComponent and the CameraComponent by default.
*/
ADandelionPlayerCharacter();
/**
* When this pawn is possesed by a controller, sets up the ASC.
* @param NewController The controller that has possessed this pawn.
*/
virtual void PossessedBy(AController* NewController) override;
protected:
/**
* Goes through the InputActionGameplayAbilityMappings and binds a forwarding function to the input system that
* sends along input events to the ASC.
* @param PlayerInputComponent The InputComponent to be setup.
*/
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
private:
/**
* The mappings from InputActions to GameplayAbilities that should be activated by said IAs.
*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AbilitySystem", meta = (AllowPrivateAccess = "true"))
TObjectPtr<UInputActionGameplayAbilityMappings> InputActionGameplayAbilityMappings;
/**
* GameplayAbilitySets that should be applied to the ASC on the PlayerState when the ASC is initialized.
*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AbilitySystem", meta = (AllowPrivateAccess = "true"))
TSet<TObjectPtr<UDandelionAbilitySet>> DefaultGameplayAbilitySets;
/**
* Sets up the ASC by configuring the owner and avatar actors and applying the DefaultGameplayAbilitySets present on
* this class and the corresponding PlayerState.
*/
void InitAbilitySystem();
/**
* Forwarding method to be called when the necessary input conditions for activating the corresponding GAs are met.
* @param InputID The InputID that was triggered.
*/
void OnAbilityInputTriggered(int32 InputID);
/**
* Forwarding method to be called when the IA is released so that the corresponding GAs can handle the event
* appropriately.
* @param InputID The InputID that was completed/released.
*/
void OnAbilityInputCompleted(int32 InputID);
#pragma region Simple Getters
public:
/**
* Simple getter for the InputActionGameplayAbilityMappings.
* @return The InputActionGameplayAbilityMappings owned by this Actor.
*/
FORCEINLINE UInputActionGameplayAbilityMappings* GetInputActionGameplayAbilityMappings() const
{
return InputActionGameplayAbilityMappings;
}
/**
* Simple getter for the CameraComponent.
* @return The CameraComponent owned by this Actor.
*/
FORCEINLINE UCameraComponent* GetTopDownCameraComponent() const { return TopDownCameraComponent; }
/**
* Simple getter for the SpringArmComponent.
* @return The SpringArmComponent owned by this Actor.
*/
FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
#pragma endregion
private:
/**
* The CameraComponent owned by this Actor.
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UCameraComponent> TopDownCameraComponent;
/**
* The SpringArmComponent owned by this Actor.
*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USpringArmComponent> CameraBoom;
/**
* Creates the SpringArmComponent by default, attaches it appropriately, and configures default values.
*/
void SetupCameraBoom();
/**
* Creates the CameraComponent by default, attaches it appropriately to the SpringArmComponent, and configures
* default values.
*/
void SetupCamera();
};
DandelionPlayerCharacter.h - Snippet hosted by \"Cacher\"
");