Implemented Open World Checkpoints to Save System
This commit is contained in:
parent
2cc1d566a6
commit
031a74352f
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f30109bb621004d765dc9b21be0826a0a251de164a9e2e5d51be11896dfb4cd0
|
||||
oid sha256:3283a43aeadedeed1d88b9a78899833a2f2acf544e82d4883589cce8095c5487
|
||||
size 43745
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
#include "MainBountyClass.h"
|
||||
|
||||
#include "CheckPoints/OpenWorldCheckpoint.h"
|
||||
#include "EndlessVendetta/EVGameInstance.h"
|
||||
|
||||
void AMainBountyClass::IncrementBountyCheckpoint()
|
||||
{
|
||||
@ -13,6 +13,7 @@ void AMainBountyClass::IncrementBountyCheckpoint()
|
||||
if (AOpenWorldCheckpoint* OWCP = Cast<AOpenWorldCheckpoint>(BountyCheckpoints[0]))
|
||||
{
|
||||
OpenWorldRespawnTransform = OWCP->GetRespawnTransform();
|
||||
OpenWorldCheckpointClasses.RemoveAt(0);
|
||||
}
|
||||
// FString TipToDisplay = "";
|
||||
// if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip();
|
||||
@ -35,6 +36,9 @@ void AMainBountyClass::DeActivateFirstCheckpoint()
|
||||
|
||||
void AMainBountyClass::SpawnOpenWorldCheckpoint()
|
||||
{
|
||||
// Get open world checkpoints from save system
|
||||
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
|
||||
OpenWorldCheckpointClasses = GI->MainSaveGameInstanceRef->OpenWorldCheckpointsClassesSave;
|
||||
if (OpenWorldCheckpointClasses.IsEmpty()) return;
|
||||
|
||||
for (TSubclassOf<ACheckpointClass> OpenWorldCheckpointClass : OpenWorldCheckpointClasses)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "BountyClass.h"
|
||||
#include "SideBountyClass.h"
|
||||
#include "CheckPoints/OpenWorldCheckpoint.h"
|
||||
#include "MainBountyClass.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
@ -42,7 +43,7 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
|
||||
// ------------------- ATTRIBUTES ------------------------------
|
||||
// Used to Spawn Open World Checkpoint for this Main Bounty
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
TArray<TSubclassOf<ACheckpointClass>> OpenWorldCheckpointClasses;
|
||||
TArray<TSubclassOf<AOpenWorldCheckpoint>> OpenWorldCheckpointClasses;
|
||||
|
||||
// Used to Store Ref for Bounty Tracking Functionality
|
||||
//TArray<ACheckpointClass*> OpenWorldcheckpoints;
|
||||
@ -97,10 +98,16 @@ public:
|
||||
// Overrides to Desapwn Waypoint from OpenWorld Checkpoint
|
||||
void DeActivateFirstCheckpoint() override;
|
||||
|
||||
// Gets Respawn Transform of Current Open World Checkpoint
|
||||
FTransform GetOpenWorldRespawnTransform()
|
||||
{
|
||||
return OpenWorldRespawnTransform;
|
||||
}
|
||||
|
||||
TArray<TSubclassOf<AOpenWorldCheckpoint>> GetOpenWorldCheckpointClasses()
|
||||
{
|
||||
return OpenWorldCheckpointClasses;
|
||||
}
|
||||
// Returns open world checkpoints tip
|
||||
// FString GetOpenWorldCheckpointTip()
|
||||
// {
|
||||
|
@ -69,6 +69,7 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty(UEVGameInstance* GI)
|
||||
if (!(MainBountyClasses.IsEmpty() || MainBountyClasses.Num() <= CurrentMainBountyIndex|| !IsValid(MainBountyClasses[CurrentMainBountyIndex])))
|
||||
{
|
||||
GI->MainSaveGameInstanceRef->SideBountiesToSpawnSave.Append(MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject<AMainBountyClass>()->GetAssociatedSideBounties());
|
||||
GI->MainSaveGameInstanceRef->OpenWorldCheckpointsClassesSave = MainBountyClasses[CurrentMainBountyIndex]->GetDefaultObject<AMainBountyClass>()->GetOpenWorldCheckpointClasses();
|
||||
}
|
||||
|
||||
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
|
||||
@ -164,6 +165,8 @@ void ABountyHunterCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
|
||||
if (!IsValid(GI->MainSaveGameInstanceRef)) return;
|
||||
|
||||
if (IsValid(CurrentMainBounty)) GI->MainSaveGameInstanceRef->OpenWorldCheckpointsClassesSave = CurrentMainBounty->GetOpenWorldCheckpointClasses();
|
||||
|
||||
// if main bounty exists, save its locally stored open world respawn transform
|
||||
// otherwise, store it as 0,0,0 which will make the player spawn at player start instead
|
||||
FTransform EmptyTransform;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "BountySystem/SideBountyClass.h"
|
||||
#include "BountySystem/CheckPoints/OpenWorldCheckpoint.h"
|
||||
#include "GameFramework/SaveGame.h"
|
||||
#include "WeaponSystem/BaseWeaponClass.h"
|
||||
#include "MainSaveGameClass.generated.h"
|
||||
@ -49,4 +50,7 @@ public:
|
||||
|
||||
UPROPERTY()
|
||||
bool bFirstPlaythroughSave;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<TSubclassOf<AOpenWorldCheckpoint>> OpenWorldCheckpointsClassesSave;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user