Implemented Open World Checkpoint Respawns
This commit is contained in:
parent
1f2243134f
commit
2cc1d566a6
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d96dde71ce13d7ed2661e3fe8d0531e67453e81644492f026f7577c12af0acf9
|
||||
size 35286
|
||||
oid sha256:ffc0494e896f842e6d6baa4953b6f317c3e2479d2b672611671fdc12fb184555
|
||||
size 35802
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a6edb31abcafeab6442cb285181905031da2635eb7c6444b529d9c8636ee9496
|
||||
size 29747
|
||||
oid sha256:253f8ebabbd32167aa4ecd182352cb52f1c337502351a1bd8f38414f6b3a9d61
|
||||
size 29197
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7367fb8f5ccaf3e4ae6e34133debe0d5efbaedf33024d14cf37b1f4f5ff7fb1c
|
||||
size 39283
|
||||
oid sha256:1c22f439331d8787e77de31ada2719cc99dd341a7a0564eeb9bd3f8fcafcc2f2
|
||||
size 38592
|
||||
|
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/OpenWorldRework.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/OpenWorldRework.umap
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Blueprints/Blueprint_CeilingLight.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.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/C/ZX/8GZK30F02QUUO234VY329I.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/C/ZX/8GZK30F02QUUO234VY329I.uasset
(Stored with Git LFS)
Binary file not shown.
@ -17,4 +17,10 @@ class ENDLESSVENDETTA_API AOpenWorldCheckpoint : public ACheckpointClass
|
||||
protected:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
|
||||
FTransform RespawnTransform;
|
||||
|
||||
public:
|
||||
FTransform GetRespawnTransform()
|
||||
{
|
||||
return RespawnTransform;
|
||||
}
|
||||
};
|
||||
|
@ -3,10 +3,17 @@
|
||||
|
||||
#include "MainBountyClass.h"
|
||||
|
||||
#include "CheckPoints/OpenWorldCheckpoint.h"
|
||||
|
||||
void AMainBountyClass::IncrementBountyCheckpoint()
|
||||
{
|
||||
Super::IncrementBountyCheckpoint();
|
||||
CompletedACheckpoint.Broadcast();
|
||||
if (BountyCheckpoints.IsEmpty() || !IsValid(BountyCheckpoints[0])) return;
|
||||
if (AOpenWorldCheckpoint* OWCP = Cast<AOpenWorldCheckpoint>(BountyCheckpoints[0]))
|
||||
{
|
||||
OpenWorldRespawnTransform = OWCP->GetRespawnTransform();
|
||||
}
|
||||
// FString TipToDisplay = "";
|
||||
// if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip();
|
||||
// Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI("", false);
|
||||
|
@ -54,9 +54,12 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
|
||||
// Used to Spawn Side Bounties Associated with this Main Bounty
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
TArray<TSubclassOf<ASideBountyClass>> SideBountiesToSpawn;
|
||||
|
||||
// Used by Bounty Char to determine where to respawn the player based on what checkpoint they're at
|
||||
FTransform OpenWorldRespawnTransform;
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
public:
|
||||
// Struct Containing all Data to be Displayed about the Main Bounty
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
@ -68,7 +71,7 @@ private:
|
||||
void IncrementBountyCheckpoint() override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
public:
|
||||
// Used by Bounty Char to Save and Spawn Side Bounties Unlocked by Activating this Main Bounty
|
||||
@ -94,6 +97,10 @@ public:
|
||||
// Overrides to Desapwn Waypoint from OpenWorld Checkpoint
|
||||
void DeActivateFirstCheckpoint() override;
|
||||
|
||||
FTransform GetOpenWorldRespawnTransform()
|
||||
{
|
||||
return OpenWorldRespawnTransform;
|
||||
}
|
||||
// Returns open world checkpoints tip
|
||||
// FString GetOpenWorldCheckpointTip()
|
||||
// {
|
||||
|
@ -133,9 +133,12 @@ void ABountyHunterCharacter::BeginPlay()
|
||||
InOpenWorld = true;
|
||||
SpawnBikeUI();
|
||||
SpawnSideBounties(GI);
|
||||
FTransform SpawnTransfrom = GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave;
|
||||
SetActorTransform(SpawnTransfrom);
|
||||
Cast<APlayerController>(GetController())->SetControlRotation(SpawnTransfrom.GetRotation().Rotator());
|
||||
if (GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave.GetLocation() != FVector(0 ,0 ,0))
|
||||
{
|
||||
FTransform SpawnTransfrom = GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave;
|
||||
SetActorTransform(SpawnTransfrom);
|
||||
Cast<APlayerController>(GetController())->SetControlRotation(SpawnTransfrom.GetRotation().Rotator());
|
||||
}
|
||||
}
|
||||
}
|
||||
CreatePauseMenuTabs();
|
||||
@ -157,9 +160,15 @@ void ABountyHunterCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
Super::EndPlay(EndPlayReason);
|
||||
if (UGameplayStatics::GetCurrentLevelName(GetWorld()) != OpenWorldLevelName) return;
|
||||
|
||||
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
|
||||
if (!IsValid(GI->MainSaveGameInstanceRef)) return;
|
||||
GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = GetActorTransform();
|
||||
|
||||
// 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;
|
||||
GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = IsValid(CurrentMainBounty) ? CurrentMainBounty->GetOpenWorldRespawnTransform() : EmptyTransform;
|
||||
//GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = GetActorTransform();
|
||||
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user