diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
index 609593f7..106f5ef3 100644
--- a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
+++ b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
@@ -8,7 +8,13 @@
+
+
+
+
+
+
@@ -140,7 +146,7 @@
-
+
diff --git a/EndlessVendetta/Content/Levels/MainMenuLevel.umap b/EndlessVendetta/Content/Levels/MainMenuLevel.umap
index ee4486ce..04cdefe0 100644
--- a/EndlessVendetta/Content/Levels/MainMenuLevel.umap
+++ b/EndlessVendetta/Content/Levels/MainMenuLevel.umap
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:0d4289da6b9ff9cbe01059bf37b1d3a758f45d2609be2e75283085f0f135d978
-size 308758
+oid sha256:fa952eb25972ab6e6dca1d46cf254f62d1684ba665ee45a7c3d6a8e3527ffac1
+size 308710
diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
index c2a34afc..64bcf76d 100644
--- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
+++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6
-size 14948
+oid sha256:769c1886c9631ccadb663c8fad5e3454f361f5bd99f6a49cf1646f88e0f267a9
+size 14831
diff --git a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
index d26afd80..0f990580 100644
--- a/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
+++ b/EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:367361338a1c76287e54fbef9427304264dd3c2ee473ba8017256cf917de1dc9
-size 66790690
+oid sha256:bc35eb2d43a47427d30aba0196f9eac90d089dd3abca319528c5d25c83510d0d
+size 72364642
diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp
index b4d65338..18b1e56e 100644
--- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp
@@ -45,20 +45,11 @@ void AMainBountyClass::SpawnCheckpoints()
ActivateFirstCheckpoint();
}
-TArray AMainBountyClass::SpawnAndReturnSideBounties()
-{
- TArray SpawnedSideBounties;
- for (auto SideBountyClass : SideBountiesToSpawn)
- {
- if (!IsValid(SideBountyClass)) continue;
- ASideBountyClass* SpawnedSideBounty = GetWorld()->SpawnActor(SideBountyClass);
- const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true);
- SpawnedSideBounty->AttachToComponent(GetRootComponent(), AttachmentTransformRules);
- SpawnedSideBounty->SpawnCheckpoints();
- SpawnedSideBounties.Add(SpawnedSideBounty);
- }
- return SpawnedSideBounties;
-}
+
+
+
+
+
void AMainBountyClass::SpawnAmmoDrops()
diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h
index 7500fc29..9908df07 100644
--- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/MainBountyClass.h
@@ -71,14 +71,17 @@ protected:
public:
+ // Used by Bounty Char to Save and Spawn Side Bounties Unlocked by Activating this Main Bounty
+ TArray> GetAssociatedSideBounties()
+ {
+ return SideBountiesToSpawn;
+ }
+
// Spawns the Single Checkpoint in the Open World for this Main Bounty
void SpawnOpenWorldCheckpoint();
void SpawnCheckpoints() override;
- // Used by Bounty Character to Spawn and Store Side Bounty Refs when Main Bounty is Updated
- TArray SpawnAndReturnSideBounties();
-
// Used by Players Character to Determine where to Spawn in the Open World after Completing Main Bounty
FTransform GetPlayerSpawnTransform()
{
diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
index 44257234..fc7a38ea 100644
--- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
@@ -20,16 +20,27 @@ void ABountyHunterCharacter::SpawnMainBounty(UEVGameInstance* GI)
CurrentMainBounty = GetWorld()->SpawnActor(MainBountyClasses[CurrentMainBountyIndex]);
const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true);
CurrentMainBounty->AttachToComponent(GetRootComponent(), AttachmentTransformRules);
-
MainBountyStruct = CurrentMainBounty->MainBountyStruct;
if (UGameplayStatics::GetCurrentLevelName(GetWorld()) != OpenWorldLevelName)
{
CurrentMainBounty->SpawnCheckpoints();
return;
}
- CurrentMainBounty->SpawnOpenWorldCheckpoint();
- CurrentSideBounties = CurrentMainBounty->SpawnAndReturnSideBounties();
+ CurrentMainBounty->SpawnOpenWorldCheckpoint();
+}
+void ABountyHunterCharacter::SpawnSideBounties(UEVGameInstance* GI)
+{
+ for (auto SideBountyClass : GI->MainSaveGameInstanceRef->SideBountiesToSpawnSave)
+ {
+ if (!IsValid(SideBountyClass)) continue;
+ ASideBountyClass* SpawnedSideBounty = GetWorld()->SpawnActor(SideBountyClass);
+ const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true);
+ SpawnedSideBounty->AttachToComponent(GetRootComponent(), AttachmentTransformRules);
+ SpawnedSideBounty->SpawnCheckpoints();
+ CurrentSideBounties.Add(SpawnedSideBounty);
+ }
+
SideBountyStructs.Empty();
for (auto SideBounty : CurrentSideBounties)
{
@@ -48,11 +59,18 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI)
GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject()->GetPlayerSpawnTransform();
CurrentMainBountyIndex = GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave;
GI->MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = CurrentMainBountyIndex;
+
+ if (!(MainBountyClasses.IsEmpty() || MainBountyClasses.Num() <= CurrentMainBountyIndex|| !IsValid(MainBountyClasses[CurrentMainBountyIndex])))
+ {
+ GI->MainSaveGameInstanceRef->SideBountiesToSpawnSave.Append(MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject()->GetAssociatedSideBounties());
+ }
+
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
}
void ABountyHunterCharacter::CompletedASideBounty(int CompletedSideBountiesUID)
{
+ FString TitleOfSideBountyToRemove = "";
for (int i = 0; i < SideBountyStructs.Num(); i++)
{
if (SideBountyStructs[i].SideBountyUID != CompletedSideBountiesUID) continue;
@@ -60,8 +78,21 @@ void ABountyHunterCharacter::CompletedASideBounty(int CompletedSideBountiesUID)
EarnFavours(SideBountyStructs[i].FavoursEarnedForCompletion);
if (IsValid(PauseMenu)) PauseMenu->UpdatePlayerStatistics(Money, Favours);
+ TitleOfSideBountyToRemove = SideBountyStructs[i].BountyTitle;
SideBountyStructs.RemoveAt(i);
UpdateBountyTabInfo();
+ break;
+ }
+
+ // Remove completed side bounty from save system
+ UEVGameInstance* GI = Cast(GetGameInstance());
+ TArray> CopyOfSideBountiesToSpawnSave = GI->MainSaveGameInstanceRef->SideBountiesToSpawnSave;
+ for (int i = 0; i < CopyOfSideBountiesToSpawnSave.Num(); i++)
+ {
+ if (CopyOfSideBountiesToSpawnSave[i]->GetDefaultObject()->SideBountyStruct.BountyTitle != TitleOfSideBountyToRemove) continue;
+ GI->MainSaveGameInstanceRef->SideBountiesToSpawnSave.RemoveAt(i);
+ UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
+ break;
}
}
@@ -82,11 +113,12 @@ void ABountyHunterCharacter::BeginPlay()
Money = GI->MainSaveGameInstanceRef->MoneySave;
Favours = GI->MainSaveGameInstanceRef->FavourSave;
SpawnMainBounty(GI);
- FTransform SpawnLoc = GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave;
- if (SpawnLoc.GetLocation() != FVector(0, 0, 0) && UGameplayStatics::GetCurrentLevelName(GetWorld()) == OpenWorldLevelName)
+ if (UGameplayStatics::GetCurrentLevelName(GetWorld()) == OpenWorldLevelName)
{
- SetActorTransform(GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave);
- Cast(GetController())->SetControlRotation(GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave.GetRotation().Rotator());
+ SpawnSideBounties(GI);
+ FTransform SpawnTransfrom = GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave;
+ SetActorTransform(SpawnTransfrom);
+ Cast(GetController())->SetControlRotation(SpawnTransfrom.GetRotation().Rotator());
}
}
CreatePauseMenuTabs();
diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
index a58d1586..8329c1dc 100644
--- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
+++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
@@ -59,8 +59,11 @@ public:
// ------------------- METHODS ---------------------------------
private:
- // Spawns Current Main Bounty along with its Side Bounties, and spawns its appropriate CP's based on level
+ // Spawns Current Main Bounty and spawns its appropriate CP's based on level
void SpawnMainBounty(UEVGameInstance* GI);
+
+ // Spawns Side Bounties from save system
+ void SpawnSideBounties(UEVGameInstance* GI);
// Collects Reward for Current Main Bounty and Increments the Main Bounty Index
void CompleteCurrentMainBounty(UEVGameInstance* GI);
@@ -256,7 +259,7 @@ private:
void DeActivateAllBounties()
{
- CurrentMainBounty->DeActivateFirstCheckpoint();
+ if (IsValid(CurrentMainBounty)) CurrentMainBounty->DeActivateFirstCheckpoint();
for (auto SideBounty : CurrentSideBounties)
{
SideBounty->DeActivateFirstCheckpoint();
diff --git a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
index 507f3c19..eeba662c 100644
--- a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
@@ -3,6 +3,7 @@
#pragma once
#include "CoreMinimal.h"
+#include "BountySystem/SideBountyClass.h"
#include "GameFramework/SaveGame.h"
#include "WeaponSystem/BaseWeaponClass.h"
#include "MainSaveGameClass.generated.h"
@@ -36,4 +37,7 @@ public:
UPROPERTY()
int FavourSave;
+
+ UPROPERTY()
+ TArray> SideBountiesToSpawnSave;
};