Implemented Landing Zone Landing Functionality
This commit is contained in:
parent
1dacb4f130
commit
195ff80dea
@ -11,10 +11,14 @@
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/Levels/ControlTutorialLevel.umap" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Levels/ControlTutorialLevel.umap" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Audio/Collapse01.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Audio/Collapse01.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/Ships/LandingZone.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Ships/LandingZone.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Particles/P_Ambient_Dust.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Particles/P_Ambient_Dust.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/LandingZone.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/LandingZone.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/SpaceShip.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/SpaceShip.h" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -129,7 +133,7 @@
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1705182847910</updated>
|
||||
<workItem from="1705182850227" duration="25480000" />
|
||||
<workItem from="1705182850227" duration="28840000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Fade.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Fade.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:40716dd78ee18731e93233dd0ed13c534868e5e9521a172e8a033011af33363d
|
||||
size 3336963
|
||||
oid sha256:9bae1373774782a35a5a728192412fe8577428a4ac37418a878beafe48aa8635
|
||||
size 3337229
|
||||
|
BIN
EndlessVendetta/Content/Ships/LandingZone.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Ships/LandingZone.uasset
(Stored with Git LFS)
Binary file not shown.
3
EndlessVendetta/Content/Ships/WBP_LandingZone.uasset
Normal file
3
EndlessVendetta/Content/Ships/WBP_LandingZone.uasset
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a9f9779b6493926f2aae045f726131d3863402a296802a028f28a9f5b069efce
|
||||
size 43413
|
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
Binary file not shown.
@ -213,6 +213,11 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
|
||||
|
||||
void AEndlessVendettaCharacter::Interact()
|
||||
{
|
||||
if (PlayerOnShip)
|
||||
{
|
||||
SpaceShip->PlayerInteracting();
|
||||
return;
|
||||
}
|
||||
FHitResult OutHit;
|
||||
FCollisionQueryParams QueryParams = FCollisionQueryParams::DefaultQueryParam;
|
||||
QueryParams.AddIgnoredActor(this);
|
||||
@ -236,6 +241,7 @@ void AEndlessVendettaCharacter::Interact()
|
||||
|
||||
void AEndlessVendettaCharacter::SetCrouch()
|
||||
{
|
||||
if (PlayerOnShip) return;
|
||||
Crouch();
|
||||
}
|
||||
|
||||
@ -279,6 +285,7 @@ float AEndlessVendettaCharacter::TakeDamage(const float DamageAmount, FDamageEve
|
||||
|
||||
void AEndlessVendettaCharacter::ToggleRecon()
|
||||
{
|
||||
if (PlayerOnShip) return;
|
||||
if (!GadgetManager->IsValidReconGadget()) return;
|
||||
|
||||
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||
@ -301,6 +308,7 @@ void AEndlessVendettaCharacter::ToggleRecon()
|
||||
|
||||
void AEndlessVendettaCharacter::ToggleCombat()
|
||||
{
|
||||
if (PlayerOnShip) return;
|
||||
if (!GadgetManager->IsValidCombatGadget()) return;
|
||||
|
||||
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||
@ -325,6 +333,7 @@ void AEndlessVendettaCharacter::ToggleCombat()
|
||||
//When 1 is pressed it calls EquipPrimary
|
||||
void AEndlessVendettaCharacter::EquipPrimary()
|
||||
{
|
||||
if (PlayerOnShip) return;
|
||||
FActorSpawnParameters spawnParams;
|
||||
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||
@ -376,6 +385,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
|
||||
void AEndlessVendettaCharacter::EquipSecondary()
|
||||
{
|
||||
if (PlayerOnShip) return;
|
||||
FActorSpawnParameters spawnParams;
|
||||
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||
@ -670,12 +680,19 @@ void AEndlessVendettaCharacter::UpdateInventorySize(int Cols, int Rows)
|
||||
|
||||
void AEndlessVendettaCharacter::EnterShip(FTransform TakeoffLoc)
|
||||
{
|
||||
PlayFadeScreen();
|
||||
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||
if (IsValid(SecondaryWeapon)) EquipSecondary();
|
||||
SpaceShip = GetWorld()->SpawnActor<ASpaceShip>(SpaceShipClass, TakeoffLoc.GetLocation(), TakeoffLoc.Rotator());
|
||||
PlayerOnShip = true;
|
||||
}
|
||||
|
||||
void AEndlessVendettaCharacter::ExitShip(FTransform ExitLoc)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Exitting Ship!!!"));
|
||||
PlayFadeScreen();
|
||||
SetActorLocation(ExitLoc.GetLocation());
|
||||
GetController()->SetControlRotation(ExitLoc.Rotator());
|
||||
SpaceShip->Destroy();
|
||||
PlayerOnShip = false;
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,9 @@ protected:
|
||||
FTimerHandle RegenHealthTimerHandle;
|
||||
void Heal(const float Amount);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void PlayFadeScreen();
|
||||
|
||||
public:
|
||||
int Money = 2000;
|
||||
AGadgetManager* GadgetManager;
|
||||
|
@ -20,6 +20,8 @@ class ENDLESSVENDETTA_API ALandingZone : public AActor, public IInteractionInter
|
||||
// Hides or shows key aesthetic features of LZ's based on if the player is landing or not
|
||||
void UpdateAllLandingZones(bool Landing);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Landing Zone")
|
||||
bool IsHomeBase_LZ = false;
|
||||
@ -32,6 +34,10 @@ public:
|
||||
// Sets default values for this actor's properties
|
||||
ALandingZone();
|
||||
|
||||
// Waypoint will display something along the lines of Press F to Land
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void SuggestLandingWidget();
|
||||
|
||||
// Ran when a player takes off from any LZ in the world
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void ShowWaypoint();
|
||||
|
@ -12,6 +12,21 @@ ASpaceShip::ASpaceShip()
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
}
|
||||
|
||||
void ASpaceShip::SightCheck()
|
||||
{
|
||||
FHitResult OutHit;
|
||||
FCollisionObjectQueryParams ObjectQueryParams;
|
||||
ObjectQueryParams.AddObjectTypesToQuery(ECollisionChannel::ECC_GameTraceChannel2);
|
||||
FVector LT_Start = SeatComponent->GetComponentLocation();
|
||||
FVector LT_End = LT_Start + (SeatComponent->GetForwardVector() * 50000);
|
||||
GetWorld()->LineTraceSingleByObjectType(OutHit, LT_Start, LT_End, ObjectQueryParams);
|
||||
ALandingZone* LZ = Cast<ALandingZone>(OutHit.GetActor());
|
||||
if (!IsValid(LZ)) return;
|
||||
Potential_LZ = LZ;
|
||||
LZ->SuggestLandingWidget();
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void ASpaceShip::BeginPlay()
|
||||
{
|
||||
@ -30,6 +45,8 @@ void ASpaceShip::Tick(float DeltaTime)
|
||||
|
||||
PlayersCharacter->SetActorLocation(SeatComponent->GetComponentLocation());
|
||||
PlayersController->SetControlRotation(GetActorRotation());
|
||||
|
||||
SightCheck();
|
||||
}
|
||||
|
||||
// Called to bind functionality to input
|
||||
@ -39,6 +56,12 @@ void ASpaceShip::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent
|
||||
|
||||
}
|
||||
|
||||
void ASpaceShip::PlayerInteracting()
|
||||
{
|
||||
if (IsValid(Potential_LZ)) Potential_LZ->Land();
|
||||
}
|
||||
|
||||
|
||||
void ASpaceShip::MoveShip(FVector2D MovementVector)
|
||||
{
|
||||
// Get ships direction vectors, and ignore their pitch
|
||||
@ -47,7 +70,6 @@ void ASpaceShip::MoveShip(FVector2D MovementVector)
|
||||
FVector RightVector = GetActorRightVector();
|
||||
RightVector.Y += RightVector.Z;
|
||||
RightVector.Z = 0;
|
||||
UE_LOG(LogTemp, Warning, TEXT("Forward:%f, Sideways:%f"), MovementVector.Y, MovementVector.X);
|
||||
AddMovementInput(ForwardVector, MovementVector.Y, true);
|
||||
AddMovementInput(RightVector, MovementVector.X, true);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "LandingZone.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
#include "SpaceShip.generated.h"
|
||||
@ -16,6 +17,10 @@ class ENDLESSVENDETTA_API ASpaceShip : public ACharacter
|
||||
AController* PlayersController;
|
||||
UArrowComponent* SeatComponent;
|
||||
|
||||
ALandingZone* Potential_LZ;
|
||||
|
||||
void SightCheck();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
@ -30,6 +35,8 @@ public:
|
||||
// Called to bind functionality to input
|
||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||
|
||||
void PlayerInteracting();
|
||||
|
||||
void MoveShip(FVector2D MovementVector);
|
||||
|
||||
void RotateShip(FVector2D LookAxisVector);
|
||||
|
Loading…
Reference in New Issue
Block a user