Added Custom Open World Spawn Location upon Completing a Main Bounty

This commit is contained in:
Rafal Swierczek 2024-02-04 18:36:42 +00:00
parent ce4f968151
commit 9d26ef66f4
10 changed files with 37 additions and 33 deletions

View File

@ -9,12 +9,14 @@
<component name="ChangeListManager">
<list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment="">
<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/StarterContent/Architecture/Floor_400x400.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Architecture/Floor_400x400.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Levels/TempOpenWorld.umap" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Levels/TempOpenWorld.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/StarterContent/Props/MaterialSphere.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Props/MaterialSphere.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/MainBountyClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/MainBountyClass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/MainSaveGameClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/MainSaveGameClass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/LandingZone.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/SpaceShip/LandingZone.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -131,7 +133,7 @@
<updated>1706900339638</updated>
<workItem from="1706900342753" duration="2652000" />
<workItem from="1706972179014" duration="11096000" />
<workItem from="1707046474738" duration="6163000" />
<workItem from="1707046474738" duration="8143000" />
</task>
<servers />
</component>

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15bdb4a6b7b73c3abed62d2af28bf942b4011d09abcb972641ae60a7006fee97
size 306352
oid sha256:185acae34cc8b4ff2298ec48a4c697230e4665427a7dcb492e93494203b190dd
size 306304

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:513e7a005246865fbaac9bf4abda7bf0473776603585a01eea1bd278711dbfce
size 13864801
oid sha256:9afe44b1d4908593e2d2ac009bb61efb016e69bf32f03198bb4bd8e51a54f0f6
size 13864753

Binary file not shown.

View File

@ -23,6 +23,10 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
// Used to Store Ref for Bounty Tracking Functionality
ACheckpointClass* OpenWorldcheckpoint;
// Used by Players Character to Determine where to Spawn in the Open World after Completing Main Bounty
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FTransform PlayerSpawnTransform;
protected:
@ -40,6 +44,11 @@ public:
// Spawns the Single Checkpoint in the Open World for this Main Bounty
void SpawnOpenWorldCheckpoint();
// Used by Players Character to Determine where to Spawn in the Open World after Completing Main Bounty
FTransform GetPlayerSpawnTransform()
{
return PlayerSpawnTransform;
}

View File

@ -33,6 +33,10 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI)
// Collect rewards for bounty and move onto next
UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty %d"), CurrentMainBountyIndex);
FTransform PostBountySpawnTransform = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject<AMainBountyClass>()->GetPlayerSpawnTransform();
SetActorTransform(PostBountySpawnTransform);
Cast<APlayerController>(GetController())->SetControlRotation(PostBountySpawnTransform.GetRotation().Rotator());
CurrentMainBountyIndex = GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave;
GI->MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = CurrentMainBountyIndex;
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
@ -73,7 +77,7 @@ void ABountyHunterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerIn
void ABountyHunterCharacter::TogglePauseMenu()
{
bool bOpenNewPauseMenu = !IsValid(PauseMenu);
const bool bOpenNewPauseMenu = !IsValid(PauseMenu);
FInputModeUIOnly UIOnly;
FInputModeGameOnly GameOnly;
APlayerController* PC = Cast<APlayerController>(GetController());
@ -82,23 +86,15 @@ void ABountyHunterCharacter::TogglePauseMenu()
PC->SetIgnoreMoveInput(bOpenNewPauseMenu);
PC->SetIgnoreLookInput(bOpenNewPauseMenu);
PC->SetShowMouseCursor(bOpenNewPauseMenu);
if (bOpenNewPauseMenu)
{
PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass);
PauseMenu->AddToViewport(50);
BountiesTab = CreateWidget(GetWorld(), BountyTabWidgetClass);
PauseMenu->OpenNewTab(BountiesTab);
}
else
if (!bOpenNewPauseMenu)
{
PauseMenu->RemoveFromParent();
PauseMenu = nullptr;
}
}
void ABountyHunterCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass);
PauseMenu->AddToViewport(50);
BountiesTab = CreateWidget(GetWorld(), BountyTabWidgetClass);
PauseMenu->OpenNewTab(BountiesTab);
}
void ABountyHunterCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)

View File

@ -76,9 +76,6 @@ protected:
// Open or Close the Pause Menu, Defaults to Opening Bounty Tab
void TogglePauseMenu();
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called When Actor destroyed or Removed from Level
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public: