Implemented Calling Bike Func

This commit is contained in:
Rafal Swierczek 2024-02-24 16:48:06 +00:00
parent 6af27aa2a6
commit b4fcc23c50
7 changed files with 31 additions and 12 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Rafal\AppData\Local\JetBrains\Rider2023.3\resharper-host\temp\Rider\vAny\CoverageData\_EndlessVendetta.-1253833435\Snapshot\snapshot.utdcvr</s:String></wpf:ResourceDictionary>

View File

@ -215,12 +215,13 @@ 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);
} }
UE_LOG(LogTemp, Warning, TEXT("Setup player input on EV character"));
} }
void AEndlessVendettaCharacter::Interact() void AEndlessVendettaCharacter::Interact()
{ {
UE_LOG(LogTemp, Warning, TEXT("Interaction Has Been Called"));
if (InPauseMenu) return; if (InPauseMenu) return;
if (bIsInDialogue) if (bIsInDialogue)
{ {
@ -740,12 +741,25 @@ void AEndlessVendettaCharacter::UpdateInventorySize(int Cols, int Rows)
} }
} }
void AEndlessVendettaCharacter::HoldInteract()
{
if (PlayerOnShip || InPauseMenu) return;
FTransform TakeOffTransform = GetActorTransform();
FVector NewLoc = TakeOffTransform.GetLocation();
NewLoc.Z += BikeRideHeight;
TakeOffTransform.SetLocation(NewLoc);
EnterShip(TakeOffTransform);
}
void AEndlessVendettaCharacter::EnterShip(FTransform TakeoffLoc) void AEndlessVendettaCharacter::EnterShip(FTransform TakeoffLoc)
{ {
PlayFadeScreen(); PlayFadeScreen();
if (IsValid(PrimaryWeapon)) EquipPrimary(); if (IsValid(PrimaryWeapon)) EquipPrimary();
if (IsValid(SecondaryWeapon)) EquipSecondary(); if (IsValid(SecondaryWeapon)) EquipSecondary();
SpaceShip = GetWorld()->SpawnActor<ASpaceShip>(SpaceShipClass, TakeoffLoc.GetLocation(), TakeoffLoc.Rotator()); FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpaceShip = GetWorld()->SpawnActor<ASpaceShip>(SpaceShipClass, TakeoffLoc.GetLocation(), TakeoffLoc.Rotator(), SpawnParams);
PlayerOnShip = true; PlayerOnShip = true;
} }

View File

@ -270,13 +270,16 @@ public:
bool bIsCurrentlyHoldingWeapon; bool bIsCurrentlyHoldingWeapon;
// Space Ship // Hover Bike
private: private:
UPROPERTY(EditDefaultsOnly, Category = "Space Ship") UPROPERTY(EditDefaultsOnly, Category = "Hover Bike")
float BikeRideHeight = 50;
UPROPERTY(EditDefaultsOnly, Category = "Hover Bike")
TSubclassOf<ASpaceShip> SpaceShipClass; TSubclassOf<ASpaceShip> SpaceShipClass;
ASpaceShip* SpaceShip; ASpaceShip* SpaceShip;
protected: protected:
bool PlayerOnShip = false; bool PlayerOnShip = false;
void HoldInteract();
public: public:
void ExitShip(FTransform ExitLoc); void ExitShip(FTransform ExitLoc);
void EnterShip(FTransform TakeoffLoc); void EnterShip(FTransform TakeoffLoc);