diff --git a/Content/Blueprints/Player/BP_ExoPlayerController.uasset b/Content/Blueprints/Player/BP_ExoPlayerController.uasset index 8f8b2b7..b7980c0 100644 Binary files a/Content/Blueprints/Player/BP_ExoPlayerController.uasset and b/Content/Blueprints/Player/BP_ExoPlayerController.uasset differ diff --git a/Content/Blueprints/Player/Inputs/IMC_ExoMappingContext.uasset b/Content/Blueprints/Player/Inputs/IMC_ExoMappingContext.uasset index c1aa112..c48cebd 100644 Binary files a/Content/Blueprints/Player/Inputs/IMC_ExoMappingContext.uasset and b/Content/Blueprints/Player/Inputs/IMC_ExoMappingContext.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Aim.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Aim.uasset new file mode 100644 index 0000000..5313155 Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Aim.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Crouch.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Crouch.uasset new file mode 100644 index 0000000..4c48e51 Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Crouch.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Dodge.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Dodge.uasset new file mode 100644 index 0000000..48a2939 Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Dodge.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Jump.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Jump.uasset new file mode 100644 index 0000000..999a8bd Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Jump.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_MeleAttack.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_MeleAttack.uasset new file mode 100644 index 0000000..4ff555b Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_MeleAttack.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Reload.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Reload.uasset new file mode 100644 index 0000000..3a77ee1 Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Reload.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Shoot.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Shoot.uasset new file mode 100644 index 0000000..caf92bb Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Shoot.uasset differ diff --git a/Content/Blueprints/Player/Inputs/Inputs/AI_Sprint.uasset b/Content/Blueprints/Player/Inputs/Inputs/AI_Sprint.uasset new file mode 100644 index 0000000..f735530 Binary files /dev/null and b/Content/Blueprints/Player/Inputs/Inputs/AI_Sprint.uasset differ diff --git a/Source/Exo/Private/Player/ExoPlayerController.cpp b/Source/Exo/Private/Player/ExoPlayerController.cpp index 21ec5d8..1891fae 100644 --- a/Source/Exo/Private/Player/ExoPlayerController.cpp +++ b/Source/Exo/Private/Player/ExoPlayerController.cpp @@ -5,6 +5,7 @@ #include "EnhancedInputComponent.h" #include "EnhancedInputSubsystems.h" #include "GameFramework/Character.h" +#include "GameFramework/CharacterMovementComponent.h" AExoPlayerController::AExoPlayerController() { @@ -15,7 +16,7 @@ void AExoPlayerController::BeginPlay() { Super::BeginPlay(); check(InputContext); - + UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem(GetLocalPlayer()); if (Subsystem) @@ -42,6 +43,8 @@ void AExoPlayerController::SetupInputComponent() EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AExoPlayerController::Move); EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AExoPlayerController::Look); EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Triggered, this, &AExoPlayerController::Interact); + EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &AExoPlayerController::PlayerJump); + EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &AExoPlayerController::PlayerDodge); } void AExoPlayerController::Move(const FInputActionValue& InputActionValue) @@ -74,3 +77,69 @@ void AExoPlayerController::Interact(const FInputActionValue& InputActionValue) if (InteractionComponent->InteractedActor) IInteractable::Execute_Interact(InteractionComponent->InteractedActor); } + +void AExoPlayerController::PlayerJump() +{ + +} + +void AExoPlayerController::PlayerDodge() +{ + UE_LOG(LogTemp, Error, TEXT("Player Dodge")); + + if (PlayerCharacter->GetCharacterMovement()->IsFalling()) return; + + if (!CanDodge) return; + + CanDodge = false; + + FVector DodgeDirection = PlayerCharacter->GetVelocity().GetSafeNormal(); + DodgeDirection.Z = 0.f; + + if (DodgeDirection.IsNearlyZero()) + DodgeDirection = PlayerCharacter->GetActorForwardVector(); + + PlayerCharacter->LaunchCharacter(DodgeDirection * DodgeForce, true, true); + + GetWorldTimerManager().SetTimer(DodgeCooldownTimer, this, &AExoPlayerController::ResetDodge, DodgeCooldown, false); +} + +void AExoPlayerController::ResetDodge() +{ + CanDodge = true; +} + +void AExoPlayerController::PlayerCrouch() +{ + +} + +void AExoPlayerController::PlayerSprint() +{ + +} + +void AExoPlayerController::PlayerShoot() +{ + +} + +void AExoPlayerController::PlayerAim() +{ + +} + +void AExoPlayerController::PlayerMeleAttack() +{ + +} + +void AExoPlayerController::PlayerChangeWeapon() +{ + +} + +void AExoPlayerController::PlayerReload() +{ + +} diff --git a/Source/Exo/Public/Player/ExoPlayerController.h b/Source/Exo/Public/Player/ExoPlayerController.h index 6085b1e..65dc0ab 100644 --- a/Source/Exo/Public/Player/ExoPlayerController.h +++ b/Source/Exo/Public/Player/ExoPlayerController.h @@ -26,14 +26,46 @@ public: protected: virtual void SetupInputComponent() override; + // Moja propozycja sterowania po prawej [Hubert] UFUNCTION(BlueprintCallable, Category = "Input") - void Move(const FInputActionValue& InputActionValue); + void Move(const FInputActionValue& InputActionValue); //WSAD UFUNCTION(BlueprintCallable, Category = "Input") - void Look(const FInputActionValue& InputActionValue); + void Look(const FInputActionValue& InputActionValue); // MouseXY UFUNCTION(BlueprintCallable, Category = "Input") - void Interact(const FInputActionValue& InputActionValue); + 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") @@ -42,12 +74,51 @@ protected: UPROPERTY(EditAnywhere, Category= "Input") TObjectPtr MoveAction; + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr InteractAction; + UPROPERTY(EditAnywhere, Category = "Input") TObjectPtr LookAction; UPROPERTY(EditAnywhere, Category = "Input") - TObjectPtr InteractAction; + TObjectPtr JumpAction; + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr SprintAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr CrouchAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr 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 ShootAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr ReloadAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr AimAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr MeleAction; + + UPROPERTY(EditAnywhere, Category = "Input") + TObjectPtr ChangeWeaponAction; + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character") TObjectPtr PlayerCharacter;