2025-02-12 19:10:23 +01:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-03-13 08:09:12 +01:00
|
|
|
#include "Characters/Components/ShootingComponent.h"
|
|
|
|
|
#include "Player/InteractionComponent.h"
|
2025-02-12 19:10:23 +01:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "GameFramework/PlayerController.h"
|
|
|
|
|
#include "ExoPlayerController.generated.h"
|
|
|
|
|
|
2025-02-21 15:59:46 +01:00
|
|
|
class AExoPlayerCharacter;
|
2025-02-12 19:10:23 +01:00
|
|
|
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;
|
|
|
|
|
|
2025-03-15 22:43:58 +01:00
|
|
|
// Po prawej przypisane aktualnie klawisze
|
2025-02-12 19:10:23 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-03-15 22:43:58 +01:00
|
|
|
void Move(const FInputActionValue& InputActionValue); // WSAD
|
2025-02-12 19:10:23 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-02-20 18:00:26 +01:00
|
|
|
void Look(const FInputActionValue& InputActionValue); // MouseXY
|
2025-02-12 19:10:23 +01:00
|
|
|
|
2025-02-17 15:28:18 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-02-21 20:42:52 +01:00
|
|
|
void Interact(); // E
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerJump(); // Space
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-03-15 22:43:58 +01:00
|
|
|
void PlayerDodge(); // Left Alt
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void ResetDodge();
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-02-22 23:31:23 +01:00
|
|
|
void PlayerStartCrouch(); // LCtrl\C\X
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-02-22 23:31:23 +01:00
|
|
|
void PlayerStopCrouch(); // LCtrl\C\X
|
|
|
|
|
|
2025-04-18 15:14:43 +02:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void ResetSlide();
|
|
|
|
|
|
2025-02-22 23:31:23 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerStartSprint(); // LShift(Hold)
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerStopSprint();
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerShoot(); // LPM
|
|
|
|
|
|
2025-04-08 18:22:33 +02:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerThrow(); // G
|
|
|
|
|
|
2025-02-20 18:00:26 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-04-04 16:33:54 +02:00
|
|
|
void PlayerStartAim(); // PPM (pressed)
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerStopAim(); // PPM (released)
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-03-15 22:43:58 +01:00
|
|
|
void PlayerMeleAttack(); // V - nieprzypisane
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
2025-03-23 21:47:10 +01:00
|
|
|
void PlayerChangeWeapon(); // MouseScroll
|
2025-03-15 22:43:58 +01:00
|
|
|
|
2025-03-23 21:47:10 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerSelectFirstWeapon(); // 1
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerSelectSecondWeapon(); // 2
|
|
|
|
|
|
2025-03-15 22:43:58 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerDropWeapon(); // F
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
|
|
|
|
void PlayerReload(); // R
|
2025-05-22 21:32:39 +02:00
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Cover System")
|
|
|
|
|
bool CheckForCover();
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Cover System")
|
|
|
|
|
void AdjustCameraWhileInCover();
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Cover System")
|
|
|
|
|
void UpdateCoverStandHeight(float DeltaTime);
|
|
|
|
|
|
|
|
|
|
void OnCoverTimer();
|
|
|
|
|
|
|
|
|
|
float MapAlphaToCoverStandHeight(float Alpha);
|
|
|
|
|
|
|
|
|
|
// DEBUG
|
|
|
|
|
UFUNCTION(Exec, Category = "Cover System")
|
|
|
|
|
void DebugCoverSystem(bool show);
|
|
|
|
|
bool bShowCoverSystemDebug = false;
|
|
|
|
|
|
2025-04-04 16:33:54 +02:00
|
|
|
|
2025-02-12 19:10:23 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputMappingContext> InputContext;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category= "Input")
|
|
|
|
|
TObjectPtr<UInputAction> MoveAction;
|
|
|
|
|
|
2025-02-20 18:00:26 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> InteractAction;
|
|
|
|
|
|
2025-02-12 19:10:23 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> LookAction;
|
|
|
|
|
|
2025-02-17 15:28:18 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
2025-02-20 18:00:26 +01:00
|
|
|
TObjectPtr<UInputAction> JumpAction;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> SprintAction;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> CrouchAction;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> DodgeAction;
|
|
|
|
|
|
2025-04-18 15:14:43 +02:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Movement Properties")
|
2025-02-20 18:00:26 +01:00
|
|
|
FTimerHandle DodgeCooldownTimer;
|
2025-02-17 15:28:18 +01:00
|
|
|
|
2025-04-18 15:14:43 +02:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Movement Properties")
|
|
|
|
|
FTimerHandle SlideCooldownTimer;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Movement Properties")
|
2025-02-20 18:00:26 +01:00
|
|
|
bool CanDodge = true;
|
2025-04-18 15:14:43 +02:00
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Movement properties")
|
|
|
|
|
bool bIsSprinting = false;
|
2025-02-20 18:00:26 +01:00
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> ShootAction;
|
2025-04-08 18:22:33 +02:00
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> ThrowAction;
|
|
|
|
|
|
2025-02-20 18:00:26 +01:00
|
|
|
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;
|
2025-03-15 22:43:58 +01:00
|
|
|
|
2025-03-23 21:47:10 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> SelectFirstWeaponAction;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> SelectSecondWeaponAction;
|
|
|
|
|
|
2025-03-15 22:43:58 +01:00
|
|
|
UPROPERTY(EditAnywhere, Category = "Input")
|
|
|
|
|
TObjectPtr<UInputAction> DropWeaponAction;
|
2025-02-20 18:00:26 +01:00
|
|
|
|
2025-02-12 19:10:23 +01:00
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character")
|
2025-02-21 15:59:46 +01:00
|
|
|
TObjectPtr<AExoPlayerCharacter> PlayerCharacter;
|
2025-02-17 15:28:18 +01:00
|
|
|
|
2025-05-22 21:32:39 +02:00
|
|
|
// Czy postać gracza jest obecnie schowana za osłoną
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Cover System")
|
|
|
|
|
bool bIsInCover = false;
|
|
|
|
|
|
|
|
|
|
/** Alpha wysokości kamery podczas wychulania zza osłony
|
|
|
|
|
* 0 - Wysokość kucania
|
|
|
|
|
* 1 - Maksymalna wysokość wychylenia określona przez CoverAimStandFactor
|
|
|
|
|
**/
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "Cover System")
|
|
|
|
|
float TargetCoverStandAlpha = 0.0f;
|
|
|
|
|
|
|
|
|
|
// Częstotliwość okresowego szukania osłon podczas kucania
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverCheckRate = 0.5f;
|
|
|
|
|
|
|
|
|
|
// Dystans na którym postać jest w stanie odnaleźć osłonę
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float MaxDistanceFromCover = 50.0f;
|
|
|
|
|
|
|
|
|
|
// Minimalna wysokość przeszkody którą można określić osłoną
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverObstacleMinHeight = 75.0f;
|
|
|
|
|
|
|
|
|
|
// Maksymalna wysokość przeszkody którą można określić osłoną
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverObstacleMaxHeight = 125.0f;
|
|
|
|
|
|
|
|
|
|
// Promień wolnej przestrzeni przez którą można się wychylić
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverAimWindowRadius = 2.0f;
|
|
|
|
|
|
|
|
|
|
// Dystans od kamery po wychyleniu który musi być wolny by dało się wychylić
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverAimFreeDistance = 150.0f;
|
|
|
|
|
|
|
|
|
|
/** Określa na jaki procent "Stania" postać może się podnieść podczas celowania
|
|
|
|
|
* zza osłony. 0 -> Nie podniesie się wogóle (jakby wychylanie się było wyłączone)
|
|
|
|
|
* 1 -> Postać jest w stanie się podnieść do pełnej wysokości, tak jakby normalnie stała
|
|
|
|
|
**/
|
|
|
|
|
UPROPERTY(EditAnywhere,
|
|
|
|
|
meta = (ClampMin = "0.0", ClampMax = "1.0",
|
|
|
|
|
UIMin = "0.0",
|
|
|
|
|
UIMax = "1.0") ,
|
|
|
|
|
BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
float CoverAimStandFactor = 0.9f;
|
|
|
|
|
|
|
|
|
|
// Trace Channel po którym szukać geometrii potencjalnych osłon
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cover System")
|
|
|
|
|
TEnumAsByte<ECollisionChannel> CoverTraceChannel = ECC_WorldStatic;
|
|
|
|
|
|
2025-02-17 15:28:18 +01:00
|
|
|
private:
|
|
|
|
|
UInteractionComponent* InteractionComponent;
|
2025-02-21 20:42:52 +01:00
|
|
|
|
|
|
|
|
UShootingComponent* ShootingComponent;
|
2025-05-22 21:32:39 +02:00
|
|
|
|
|
|
|
|
float CoverStandAlpha = 0.0f;
|
|
|
|
|
FTimerHandle CoverCheckTimer;
|
|
|
|
|
float MaxCoverAimHeight;
|
2025-02-12 19:10:23 +01:00
|
|
|
};
|