57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Camera/CameraComponent.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "InputAction.h"
|
|
#include "PlayerCharacter.generated.h"
|
|
|
|
UCLASS()
|
|
class CODREMAKE_API APlayerCharacter : public ACharacter
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this character's properties
|
|
APlayerCharacter();
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Player|Character", Meta = (AllowPrivateAccess = "true"))
|
|
TObjectPtr<UCameraComponent> CameraComponent;
|
|
|
|
#pragma region Inputs
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player|Enhanced Input")
|
|
class UInputMappingContext* InputMapping;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player|Enhanced Input")
|
|
UInputAction* IA_Move;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player|Enhanced Input")
|
|
UInputAction* IA_Look;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Player|Enhanced Input")
|
|
UInputAction* IA_Jump;
|
|
|
|
// Handle move input
|
|
void Move(const FInputActionValue& Value);
|
|
|
|
// Handle look input
|
|
void Look(const FInputActionValue& Value);
|
|
|
|
void ActivateJump(const FInputActionValue& Value);
|
|
#pragma endregion
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
// Called to bind functionality to input
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
};
|