ExoWest/Source/Exo/Public/Player/ExoPlayerController.h
Foxim 2b6bdf9f80 feat: add grenade pickup, throw, and drop mechanics
Implemented basic grenade interaction:
- Player can pick up, throw, and drop grenades.

To-do:
- Refine throwing mechanics (e.g. direction, force).
- Clean up and refactor related code.
2025-04-08 18:22:33 +02:00

158 lines
4.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Characters/Components/ShootingComponent.h"
#include "Player/InteractionComponent.h"
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ExoPlayerController.generated.h"
class AExoPlayerCharacter;
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;
// Po prawej przypisane aktualnie klawisze
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(); // E
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerJump(); // Space
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerDodge(); // Left Alt
UFUNCTION(BlueprintCallable, Category = "Input")
void ResetDodge();
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStartCrouch(); // LCtrl\C\X
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStopCrouch(); // LCtrl\C\X
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStartSprint(); // LShift(Hold)
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStopSprint();
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerShoot(); // LPM
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerThrow(); // G
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStartAim(); // PPM (pressed)
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerStopAim(); // PPM (released)
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerMeleAttack(); // V - nieprzypisane
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerChangeWeapon(); // MouseScroll
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerSelectFirstWeapon(); // 1
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerSelectSecondWeapon(); // 2
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerDropWeapon(); // F
UFUNCTION(BlueprintCallable, Category = "Input")
void PlayerReload(); // R
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")
bool CanDodge = true;
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputAction> ShootAction;
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputAction> ThrowAction;
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, Category = "Input")
TObjectPtr<UInputAction> SelectFirstWeaponAction;
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputAction> SelectSecondWeaponAction;
UPROPERTY(EditAnywhere, Category = "Input")
TObjectPtr<UInputAction> DropWeaponAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character")
TObjectPtr<AExoPlayerCharacter> PlayerCharacter;
private:
UInteractionComponent* InteractionComponent;
UShootingComponent* ShootingComponent;
};