diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
index 932bc015..e4812422 100644
--- a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
+++ b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml
@@ -9,13 +9,18 @@
+
+
+
+
-
-
+
+
+
@@ -146,6 +151,8 @@
+
+
diff --git a/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/CP_GoToFinanceCentre.uasset b/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/CP_GoToFinanceCentre.uasset
index 5779f4c9..441f3685 100644
--- a/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/CP_GoToFinanceCentre.uasset
+++ b/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/CP_GoToFinanceCentre.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:474599332f82e0e18990902c5a79b7de5dd80a4e9c7fe016b22fd4280f96936e
-size 80064
+oid sha256:6cdc863b9bd4477a188dfba127b747fad85d5a2be2adba1663696d88db0ca63c
+size 82240
diff --git a/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/SB_MoneyProblems.uasset b/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/SB_MoneyProblems.uasset
index df80c1fb..b4b69fd6 100644
--- a/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/SB_MoneyProblems.uasset
+++ b/EndlessVendetta/Content/BountySystem/ApartmentBounty/SideBounties/MoneyProblems/SB_MoneyProblems.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:e10c7eef9ffc82523eb772b5a1b467de0c1f56d4014ded77da9c3dbba11b3296
-size 22940
+oid sha256:1c446d428c4db33e1efa43f9aef00a8c8196d48158436b7d93d128805ee2347c
+size 23052
diff --git a/EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset b/EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset
index 79f24720..2540de5f 100644
--- a/EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset
+++ b/EndlessVendetta/Content/BountySystem/ControlsTutorial/Bounty/MB_Training.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:e7c0eee778caa45c4640871d924966e7415272eff04a16cc96e3056c7f5b488b
-size 28006
+oid sha256:3911424435eeeeba61add4579c324414dafe7fdac48d660bac6dbf9de909e9eb
+size 28055
diff --git a/EndlessVendetta/Content/Levels/MainMenuLevel.umap b/EndlessVendetta/Content/Levels/MainMenuLevel.umap
index bd4d0a4e..ee4486ce 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:7f9eeb93d9528280841ebfa552cc29d769515d093467e822741471ff85488699
-size 308710
+oid sha256:0d4289da6b9ff9cbe01059bf37b1d3a758f45d2609be2e75283085f0f135d978
+size 308758
diff --git a/EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset b/EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset
index d9e34568..016a7344 100644
--- a/EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset
+++ b/EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:64ca05e586e2efad00caccb8877e80ff186de099c7271b368fea7ed544606929
-size 485440
+oid sha256:ff738c6b1ccafb79a8381f4e2ae3b6015ba59a191a0f50db49b6864f0426489f
+size 508962
diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
index 41df6b83..c2a34afc 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:2323ff7b602d5c5ba8fabfde5e135cff8ef59601c45e57b68f702bc0ad75214f
-size 14831
+oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6
+size 14948
diff --git a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
index c5c3b84e..1c96a46a 100644
--- a/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
+++ b/EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:4a60a29ad596546d481e43dfb8698842a78cc07f4a4b1000fa397cfba4e72331
-size 158206
+oid sha256:8881ec1ec0d7d6bc38838abb480029b4fd720e7ed108e487f6cb348f21386a66
+size 43745
diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h
index 06bcc3bb..84dfe612 100644
--- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/BountyClass.h
@@ -31,6 +31,12 @@ protected:
public:
FCompletedACheckpoint CompletedACheckpoint;
+
+ // Gets the Reward Money for Completing this Bounty, used by Players Character
+ int GetRewardMoney()
+ {
+ return RewardMoney;
+ }
// ------------------- METHODS ---------------------------------
diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp
index d6227ac5..291b3499 100644
--- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp
@@ -7,6 +7,7 @@
void ASideBountyClass::BeginPlay()
{
SideBountyStruct.SideBountyUID = GetUniqueID();
+ SideBountyStruct.MoneyEarnedForCompletion = RewardMoney;
Super::BeginPlay();
}
diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h
index d71cafc8..67c0cf2b 100644
--- a/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/SideBountyClass.h
@@ -23,6 +23,8 @@ struct FSideBountyStruct
// Amount of Favours the Player will earn for Completing this Side Bounty
UPROPERTY(EditDefaultsOnly)
int FavoursEarnedForCompletion = 1;
+
+ int MoneyEarnedForCompletion = 0;
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCompletedSideBounty, int, SB_UID);
diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
index 9e97f363..d5e67fe1 100644
--- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp
@@ -34,13 +34,14 @@ void ABountyHunterCharacter::SpawnMainBounty(UEVGameInstance* GI)
for (auto SideBounty : CurrentSideBounties)
{
SideBountyStructs.Add(SideBounty->SideBountyStruct);
- SideBounty->CompletedSideBounty.AddDynamic(this, &CompletedASideBounty);
+ SideBounty->CompletedSideBounty.AddDynamic(this, &ABountyHunterCharacter::CompletedASideBounty);
}
}
void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI)
{
- // Collect rewards for bounty and move onto next
+ EarnMoney(MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject()->GetRewardMoney());
+ if (IsValid(PauseMenu)) PauseMenu->UpdatePlayerStatistics(Money, Favours);
UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty %d"), CurrentMainBountyIndex);
// Saves players spawn now as players location is set after spawn main bounty finishes running in begin play
@@ -55,7 +56,9 @@ void ABountyHunterCharacter::CompletedASideBounty(int CompletedSideBountiesUID)
for (auto SBStruct : SideBountyStructs)
{
if (SBStruct.SideBountyUID != CompletedSideBountiesUID) continue;
- //Continue writing code here about gaining money and favours
+ EarnMoney(SBStruct.MoneyEarnedForCompletion);
+ EarnFavours(SBStruct.FavoursEarnedForCompletion);
+ if (IsValid(PauseMenu)) PauseMenu->UpdatePlayerStatistics(Money, Favours);
}
}
@@ -64,11 +67,22 @@ void ABountyHunterCharacter::AllBountiesCompleted()
UE_LOG(LogTemp, Warning, TEXT("Game Completed!!!! No more Bounties left... or you forgot to set a bounty at one of the indexes oof"));
}
+void ABountyHunterCharacter::SavePlayerMoneyAndFavours()
+{
+ UEVGameInstance* GI = Cast(GetGameInstance());
+ if (!IsValid(GI->MainSaveGameInstanceRef)) return;
+ GI->MainSaveGameInstanceRef->MoneySave = Money;
+ GI->MainSaveGameInstanceRef->FavourSave = Favours;
+ UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
+}
+
void ABountyHunterCharacter::BeginPlay()
{
UEVGameInstance* GI = Cast(GetGameInstance());
if (IsValid(GI->MainSaveGameInstanceRef))
{
+ 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)
@@ -162,6 +176,7 @@ void ABountyHunterCharacter::TogglePauseMenu()
return;
}
PauseMenu = CreateWidget(GetWorld(), PauseMenuWidgetClass, FName("PauseMenu"));
+ PauseMenu->UpdatePlayerStatistics(Money, Favours);
PauseMenu->AddToViewport(50);
PauseMenu->OpenNewTab(BountiesTab);
PauseMenu->OpenedBountiesTab.AddDynamic(this, &ABountyHunterCharacter::OpenBountiesTab);
diff --git a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
index f9092fd1..1662f003 100644
--- a/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
+++ b/EndlessVendetta/Source/EndlessVendetta/Characters/BountyHunterCharacter.h
@@ -23,6 +23,12 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac
GENERATED_BODY()
// ------------------- ATTRIBUTES ------------------------------
+ // Money Used for Buying things
+ int Money = 0;
+
+ // Favours used for making bounties easier
+ int Favours = 0;
+
// Array of Main Bounties' Classes in Order
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
TArray> MainBountyClasses;
@@ -45,6 +51,9 @@ protected:
public:
+
+
+
// ------------------- METHODS ---------------------------------
private:
// Spawns Current Main Bounty along with its Side Bounties, and spawns its appropriate CP's based on level
@@ -60,6 +69,8 @@ private:
// Replaces Normal Bounty Info UI with Unique Game Over UI
void AllBountiesCompleted();
+ void SavePlayerMoneyAndFavours();
+
protected:
// Called When Player Spawns
virtual void BeginPlay() override;
@@ -77,6 +88,42 @@ public:
return OpenWorldLevelName;
}
+ // Public incase Money can be earned through outside sources in the future
+ void EarnMoney(int MoneyEarned)
+ {
+ Money += MoneyEarned;
+ SavePlayerMoneyAndFavours();
+ }
+
+ // Checks if player has enough money to spend, if true then spend money and return true
+ bool SpendMoney(int MoneySpent)
+ {
+ if (MoneySpent > Money) return false;
+ Money -= MoneySpent;
+ SavePlayerMoneyAndFavours();
+ return true;
+ }
+
+ // Public incase favours can be earned through outside sources in the future
+ void EarnFavours(int FavoursEarned)
+ {
+ Favours += FavoursEarned;
+ SavePlayerMoneyAndFavours();
+ }
+
+ // Checks if player has enough favours to spend, if true then spend favours and return true
+ bool SpendFavours(int FavoursSpent)
+ {
+ if (FavoursSpent > Favours) return false;
+ Favours -= FavoursSpent;
+ SavePlayerMoneyAndFavours();
+ return true;
+ }
+
+
+
+
+
// ------------------- Pause Menu ---------------------------------
private:
// Input Action for Opening and Closing Pause Menu
diff --git a/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp b/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp
index 05044761..e42561a3 100644
--- a/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/EVGameInstance.cpp
@@ -12,6 +12,8 @@ void UEVGameInstance::CreateNewSaveGameInstance()
MainSaveGameInstanceRef = Cast(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass()));
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0;
MainSaveGameInstanceRef->LastMainBountyIndexInOpenWorld = 0;
+ MainSaveGameInstanceRef->MoneySave = 0;
+ MainSaveGameInstanceRef->FavourSave = 0;
UGameplayStatics::SaveGameToSlot(MainSaveGameInstanceRef, "MainSave", 0);
}
diff --git a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
index ccd11131..507f3c19 100644
--- a/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/MainSaveGameClass.h
@@ -30,4 +30,10 @@ public:
UPROPERTY()
FTransform PlayerOpenWorldSpawnTransformSave;
+
+ UPROPERTY()
+ int MoneySave;
+
+ UPROPERTY()
+ int FavourSave;
};
diff --git a/EndlessVendetta/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h b/EndlessVendetta/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h
index fff8ea82..f65cacf2 100644
--- a/EndlessVendetta/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h
+++ b/EndlessVendetta/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h
@@ -37,5 +37,9 @@ public:
public:
// Closes any Previously Opened Tab and Opens the Given new Tab
UFUNCTION(BlueprintImplementableEvent)
- void OpenNewTab(UTabWidget* TabWidget);
+ void OpenNewTab(UTabWidget* TabWidget);
+
+ // Updates Displayed Player Statistics, aka Money and Favours
+ UFUNCTION(BlueprintImplementableEvent)
+ void UpdatePlayerStatistics(int NewMoney, int NewFavours);
};