- #pragma once
- #include "CoreMinimal.h"
- #include "Components/ActorComponent.h"
- #include "World/Climbable.h"
- #include "Components/CapsuleComponent.h"
- #include "AI/Navigation/AvoidanceManager.h"
- #include "ClimbingComponent.generated.h"
- UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
- class THEELDER_API UClimbingComponent : public UActorComponent
- {
- GENERATED_BODY()
- public:
- // Sets default values for this component's properties
- UClimbingComponent();
- /* This should be sent from the player controller, via the default input axis callbacks */
- void SendVerticalInput(float input);
- /* This should be sent from the player controller, via the default input axis callbacks */
- void SendHorizontalInput(float input);
- /* This should be sent from the player controller, on a button press*/
- void ForceInitClimb();
- AClimbable* FindBestClimbable();
- void DetectClimbables();
- protected:
- // Called when the game starts
- virtual void BeginPlay() override;
- void Init(UCharacterMovementComponent* ParentCharacterMovement, UCapsuleComponent* ParentCapsule);
- public:
- // Called every frame
- virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
- TArray<AClimbable*> ConvertArrayToClimbable(TArray<AActor*> ActorArray);
- UPROPERTY(EditDefaultsOnly, Category = "Tunables")
- float ClimbingDetectionRadius = 800.0f;
- UPROPERTY(EditDefaultsOnly, Category = "Debugging")
- bool bIsDebugging = false;
- UPROPERTY()
- UCapsuleComponent* CharacterCapsule;
- UPROPERTY()
- UCharacterMovementComponent* CharacterMovement;
- private:
- bool bHasPossibleTargets = false;
- bool bIsClimbing = false;
- TArray<AClimbable*> PossibleClimbables;
- /*The climbable we're currently on*/
- AClimbable CurrentClimbable;
- /*The climbable we're going to move to*/
- AClimbable NextClimbable;
- };