Integrated Tutorial Bounty and WIP Apartment Bounty using Save System

This commit is contained in:
Rafal Swierczek 2024-02-01 15:32:43 +00:00
parent 486753b814
commit e205f7522c
22 changed files with 139 additions and 71 deletions

View File

@ -9,16 +9,23 @@
<component name="ChangeListManager">
<list default="true" id="8acc2658-cb31-4c49-857f-282cfee74640" 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/BountySystem/ApartmentBounty/MB_Apartment.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/BountySystem/ApartmentBounty/MB_Apartment.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Gadgets/CombatGadgets/OverloadModule/CG_OverloadModule.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Gadgets/ReconGadgets/RingModule/RG_RingModule.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Levels/ControlTutorialLevel.umap" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Levels/ControlTutorialLevel.umap" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/Levels/MainMenuLevel.umap" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Levels/MainMenuLevel.umap" 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/MainMenu/BP_MainSaveGame.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/MainMenu/BP_MainSaveGame.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/MainMenu/Gameplay/MainMenuPlayerController.uasset" 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/StarterContent/Audio/Collapse01.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Audio/Collapse01.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/BountyClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/BountyClass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/MainBountyClass.cpp" 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/BountySystem/SideBountyClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/SideBountyClass.cpp" 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/EVGameInstance.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EVGameInstance.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/EVGameInstance.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EVGameInstance.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/MainSaveGameClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/MainSaveGameClass.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -140,6 +147,9 @@
<workItem from="1706036726146" duration="5339000" />
<workItem from="1706101472121" duration="21314000" />
<workItem from="1706203836052" duration="7461000" />
<workItem from="1706626387819" duration="5432000" />
<workItem from="1706711852868" duration="19944000" />
<workItem from="1706799696925" duration="703000" />
</task>
<servers />
</component>

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8bf06e49f17ab25c9dc3262bca893f73ef07c79a7ec7535d77a8228abe61b14b
size 22201
oid sha256:b3961e22842e8bb12c11a7a3e55793f49209fbdecbcb861ef0296af14b5c36b0
size 23374

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9d9166bbded21f9f0972c11067858db21c9157ff4b5acbbb1113348f9ae065e7
size 27092

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4eb5c92180442aaa9dae7586d0d0effec22d5dc4ca432330aac7899e893ba608
size 458530
oid sha256:6f04647dc2631937f70cae35ade2cb79606f89676a7552e29ea9b2e5f02c9bce
size 458370

Binary file not shown.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e347eab07faf7d90209e7e64ba12694fe4804e27f840b4e171fd428466e9803
size 299618
oid sha256:9d351bbac850938f4243559fb2004190dc0a9ecc375e967e1beee57237a90123
size 299666

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dfdc199106ad2fca8d90af627e6c092483714378c3e4014dd6124fb5538b36b5
size 13860679
oid sha256:fd850d01c7675c006d7aa19c1ea2d9592326c10d27331654c11c6f2f79454d6a
size 13864680

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:97f269934ce59b24b2c67b91559683c19b2f22cbcc081c843655f7dc3320fe2f
size 146848
oid sha256:fb2866d4ceb699f5ab8a45d5fe54ca1d4c7110cd78fde174771b73e6a9bc2253
size 108722

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6038bf29408d4c5be111de70be0878efba11fba22cfe715ed745704d48e6c243
oid sha256:22ae623a43a551b2c36f14689aeb372567771b015c4668c364a3fd54d4f325d5
size 14831

View File

@ -8,6 +8,7 @@
#include "BountyClass.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedFirstCheckpoint);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedACheckpoint);
UCLASS()
class ENDLESSVENDETTA_API ABountyClass : public AActor
@ -21,13 +22,11 @@ class ENDLESSVENDETTA_API ABountyClass : public AActor
TArray<TSubclassOf<ACheckpointClass>> CheckpointsToSpawn;
protected:
// Has a Get Func, Used for Identifying if the Bounty has been Completed
bool Completed = false;
// Array of References to the Spawned in Checkpoints for this Bounty
TArray<ACheckpointClass*> BountyCheckpoints;
public:
FCompletedACheckpoint CompletedACheckpoint;
// ------------------- METHODS ---------------------------------
@ -85,7 +84,7 @@ public:
// ------ Getters for Bounty and Checkpoint Properties ------
bool IsCompleted()
{
return Completed;
return false;
}
FString GetBountyTitle()

View File

@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "FinalCheckpoint.h"
#include "EndlessVendetta/EVGameInstance.h"
#include "EndlessVendetta/Characters/BountyHunterCharacter.h"
#include "Kismet/GameplayStatics.h"
void AFinalCheckpoint::CompleteBounty()
{
UEVGameInstance* GI = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
if (!IsValid(GI)) return;
GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave++;
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
FName OpnWrldLvlName = FName(Cast<ABountyHunterCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->GetOpenWorldLevelName());
UGameplayStatics::OpenLevel(GetWorld(), OpnWrldLvlName);
}

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "EndlessVendetta/BountySystem/CheckpointClass.h"
#include "FinalCheckpoint.generated.h"
/**
*
*/
UCLASS()
class ENDLESSVENDETTA_API AFinalCheckpoint : public ACheckpointClass
{
GENERATED_BODY()
protected:
// Increment and Save Current Main Bounty Index, as well as load Open World Level
UFUNCTION(BlueprintCallable)
void CompleteBounty();
};

View File

@ -6,11 +6,29 @@
void AMainBountyClass::IncrementBountyCheckpoint()
{
Super::IncrementBountyCheckpoint();
FString TipToDisplay = "";
if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip();
Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI(TipToDisplay, Completed);
CompletedACheckpoint.Broadcast();
// FString TipToDisplay = "";
// if (!Completed) TipToDisplay = BountyCheckpoints[0]->GetCheckpointTip();
// Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI("", false);
}
void AMainBountyClass::SpawnOpenWorldCheckpoint()
{
if (!IsValid(OpenWorldCheckpointClass)) return;
FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
FVector Loc = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetLocation();
FRotator Rot = OpenWorldCheckpointClass.GetDefaultObject()->GetCheckpointSpawnTransform().GetRotation().Rotator();
OpenWorldcheckpoint = GetWorld()->SpawnActor<ACheckpointClass>(OpenWorldCheckpointClass, Loc, Rot, SpawnParameters);
OpenWorldcheckpoint->SpawnWaypoint(BountyTitle);
}
void AMainBountyClass::SpawnAmmoDrops()
{

View File

@ -20,8 +20,8 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TSubclassOf<ACheckpointClass> OpenWorldCheckpointClass;
// Only Function of this Checkpoint is to Guide the Player to the Bounty Start Area
ACheckpointClass* OpenWorldCheckpointRef;
// Used to Store Ref for Bounty Tracking Functionality
ACheckpointClass* OpenWorldcheckpoint;
protected:
@ -34,19 +34,11 @@ private:
void IncrementBountyCheckpoint() override;
protected:
// Sets completed to true when last checkpoint broadcasts completion
UFUNCTION()
void CompletedMainBounty()
{
Completed = true;
}
public:
// Spawns the Single Checkpoint in the Open World for this Main Bounty
void SpawnOpenWorldCheckpoint()
{
UE_LOG(LogTemp, Warning, TEXT("Spawning Open World Checkpoint"));
}
void SpawnOpenWorldCheckpoint();

View File

@ -13,10 +13,12 @@ void ASideBountyClass::IncrementBountyCheckpoint()
{
Super::IncrementBountyCheckpoint();
if (Completed)
{
CompletedSideBounty.Broadcast(FavoursEarnedForCompletion);
}
// Rework!!!!
// if (Completed)
// {
// CompletedSideBounty.Broadcast(FavoursEarnedForCompletion);
// }
}
void ASideBountyClass::DestroyCheckpoints()

View File

@ -6,27 +6,19 @@
#include "EndlessVendetta/EVGameInstance.h"
#include "Kismet/GameplayStatics.h"
void ABountyHunterCharacter::SpawnBounties()
void ABountyHunterCharacter::SpawnMainBounty()
{
UE_LOG(LogTemp, Warning, TEXT("Spawning Bounty..."));
UEVGameInstance* GI = Cast<UEVGameInstance>(GetGameInstance());
if (!IsValid(GI->MainSaveGameInstanceRef)) return;
if (!IsValid(GI->MainSaveGameInstanceRef))
if (GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave > CurrentMainBountyIndex) CompleteCurrentMainBounty();
if (MainBountyClasses.IsEmpty() || MainBountyClasses.Num() <= CurrentMainBountyIndex|| !IsValid(MainBountyClasses[CurrentMainBountyIndex]))
{
UE_LOG(LogTemp, Warning, TEXT("Main save Game Object isnt initialized in GI"));
AllBountiesCompleted();
return;
}
int TestNum = GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave;
UE_LOG(LogTemp, Warning, TEXT("Current Index is set to....%d"), TestNum);
GI->MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 40;
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
if (MainBountyClasses.IsEmpty() || !IsValid(MainBountyClasses[CurrentMainBountyIndex])) return;
CurrentMainBounty = GetWorld()->SpawnActor<AMainBountyClass>(MainBountyClasses[CurrentMainBountyIndex]);
const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true);
AttachToComponent(GetRootComponent(), AttachmentTransformRules);
@ -36,12 +28,19 @@ void ABountyHunterCharacter::SpawnBounties()
void ABountyHunterCharacter::CompleteCurrentMainBounty()
{
// Collect rewards for bounty and move onto next
UE_LOG(LogTemp, Warning, TEXT("Would be collecting reward for completing bounty and moving onto next if possible"));
CurrentMainBountyIndex++;
}
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::BeginPlay()
{
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) SpawnBounties();
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) SpawnMainBounty();
Super::BeginPlay();
}

View File

@ -22,7 +22,6 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac
TArray<TSubclassOf<AMainBountyClass>> MainBountyClasses;
// Reference to the Currently Active Main Bounty
UPROPERTY(VisibleAnywhere, Category = "Bounty Hunter")
AMainBountyClass* CurrentMainBounty;
// Index of Currently Active Main Bounty, Used for MainBountyClasses
@ -40,13 +39,14 @@ public:
// ------------------- METHODS ---------------------------------
private:
// Spawns Current Main Bounty along with its Side Bounties, and spawns its appropriate CP's based on level
UFUNCTION(BlueprintCallable, Category = "Bounty Hunter")
void SpawnBounties();
void SpawnMainBounty();
// Checks if Player Completed Current Main Bounty, if so Collects Reward and Tries to Move onto Next Main Bounty
UFUNCTION(BlueprintCallable, Category = "Bounty Hunter")
// Collects Reward for Current Main Bounty and Increments the Main Bounty Index
void CompleteCurrentMainBounty();
// Replaces Normal Bounty Info UI with Unique Game Over UI
void AllBountiesCompleted();
protected:
// Called When Player Spawns
virtual void BeginPlay() override;
@ -54,5 +54,10 @@ protected:
// Called every frame
virtual void Tick(float DeltaTime) override;
public:
// Used by Final Checkpoint to always load the Level set as the Open Level in here
FString GetOpenWorldLevelName()
{
return OpenWorldLevelName;
}
};

View File

@ -9,9 +9,8 @@ void UEVGameInstance::CreateNewSaveGameInstance()
{
if (UGameplayStatics::DoesSaveGameExist("MainSave", 0)) UGameplayStatics::DeleteGameInSlot("MainSave", 0);
UE_LOG(LogTemp, Warning, TEXT("Creating new save game instance"));
MainSaveGameInstanceRef = Cast<UMainSaveGameClass>(UGameplayStatics::CreateSaveGameObject(UMainSaveGameClass::StaticClass()));
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 20;
MainSaveGameInstanceRef->CurrentMainBountyIndexSave = 0;
UGameplayStatics::SaveGameToSlot(MainSaveGameInstanceRef, "MainSave", 0);
}