Added dodge mechanic with temporary values for testing. Dodge properties (dodge force., cooldown) are subject to change.
128 lines
3.5 KiB
C++
128 lines
3.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/PlayerController.h"
|
|
#include <Player/InteractionComponent.h>
|
|
#include "ExoPlayerController.generated.h"
|
|
|
|
class UInputMappingContext;
|
|
class UInputAction;
|
|
struct FInputActionValue;
|
|
|
|
UCLASS()
|
|
class EXO_API AExoPlayerController : public APlayerController
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AExoPlayerController();
|
|
|
|
virtual void BeginPlay() override;
|
|
|
|
virtual void PlayerTick(float DeltaTime) override;
|
|
|
|
protected:
|
|
virtual void SetupInputComponent() override;
|
|
|
|
// Moja propozycja sterowania po prawej [Hubert]
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void Move(const FInputActionValue& InputActionValue); //WSAD
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void Look(const FInputActionValue& InputActionValue); // MouseXY
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void Interact(const FInputActionValue& InputActionValue); // E
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerJump(); // Space
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerDodge(); // LShift(Pressed)
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void ResetDodge();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerCrouch(); // LCtrl\C\X
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerSprint(); // LShift(Hold)
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerShoot(); // LPM
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerAim(); // PPM
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerMeleAttack(); // V
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerChangeWeapon(); // 1\2\MouseScroll
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
void PlayerReload(); // R
|
|
|
|
|
|
protected:
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputMappingContext> InputContext;
|
|
|
|
UPROPERTY(EditAnywhere, Category= "Input")
|
|
TObjectPtr<UInputAction> MoveAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> InteractAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> LookAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> JumpAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> SprintAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> CrouchAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> DodgeAction;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Dodge Properties")
|
|
FTimerHandle DodgeCooldownTimer;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Dodge Properties")
|
|
float DodgeForce = 5000.f; // Move to player if future for better modification
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Dodge Properties")
|
|
float DodgeCooldown = 2.f; // Move to player too.
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Dodge Properties")
|
|
bool CanDodge = true;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> ShootAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> ReloadAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> AimAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> MeleAction;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
TObjectPtr<UInputAction> ChangeWeaponAction;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character")
|
|
TObjectPtr<ACharacter> PlayerCharacter;
|
|
|
|
private:
|
|
UInteractionComponent* InteractionComponent;
|
|
};
|