Implemented Exiting Hover Bike along with its UI

This commit is contained in:
Rafal Swierczek 2024-02-25 08:57:20 +00:00
parent b4fcc23c50
commit 82a4951990
10 changed files with 34 additions and 12 deletions

BIN
EndlessVendetta/Content/FirstPerson/BlueRoundedBox.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
EndlessVendetta/Content/FirstPerson/BlueRoundedBox.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -216,6 +216,7 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
//Interacting //Interacting
EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Interact); EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Interact);
EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::HoldInteract); EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::HoldInteract);
EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Canceled, this, &AEndlessVendettaCharacter::StoppedHoldingInteract);
} }
} }
@ -228,6 +229,7 @@ void AEndlessVendettaCharacter::Interact()
Cast<UAC_PlayerDialogueInterpreter>(GetComponentByClass(UAC_PlayerDialogueInterpreter::StaticClass()))->NextDialogue(); Cast<UAC_PlayerDialogueInterpreter>(GetComponentByClass(UAC_PlayerDialogueInterpreter::StaticClass()))->NextDialogue();
return; return;
} }
StartedHoldingInteract(1.f / HoldForInteractionDuration);
if (PlayerOnShip) if (PlayerOnShip)
{ {
SpaceShip->PlayerInteracting(); SpaceShip->PlayerInteracting();
@ -743,7 +745,12 @@ void AEndlessVendettaCharacter::UpdateInventorySize(int Cols, int Rows)
void AEndlessVendettaCharacter::HoldInteract() void AEndlessVendettaCharacter::HoldInteract()
{ {
if (PlayerOnShip || InPauseMenu) return; if (InPauseMenu) return;
if (PlayerOnShip)
{
ExitShip(GetActorTransform());
return;
}
FTransform TakeOffTransform = GetActorTransform(); FTransform TakeOffTransform = GetActorTransform();
FVector NewLoc = TakeOffTransform.GetLocation(); FVector NewLoc = TakeOffTransform.GetLocation();
NewLoc.Z += BikeRideHeight; NewLoc.Z += BikeRideHeight;

View File

@ -129,6 +129,7 @@ public:
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
bool bIsInDialogue = false; bool bIsInDialogue = false;
protected: protected:
virtual void BeginPlay() override; virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
@ -228,7 +229,12 @@ protected:
UPROPERTY(EditDefaultsOnly, Category = "Interaction") UPROPERTY(EditDefaultsOnly, Category = "Interaction")
float InteractionRange = 250; float InteractionRange = 250;
void Interact(); void Interact();
UPROPERTY(EditDefaultsOnly, Category = "Interaction")
float HoldForInteractionDuration = 0.5f;
UFUNCTION(BlueprintImplementableEvent)
void StartedHoldingInteract(float Duration);
UFUNCTION(BlueprintImplementableEvent)
void StoppedHoldingInteract();
protected: protected:
// Used by vault it plugin to run vaulting animations // Used by vault it plugin to run vaulting animations
USkeletalMeshComponent* FP_SkeletalMesh = nullptr; USkeletalMeshComponent* FP_SkeletalMesh = nullptr;