WIP Refactoring Main Bounty and Bounty Classes to Fit New Save System
This commit is contained in:
parent
9c48ae9465
commit
3558936f86
@ -9,6 +9,14 @@
|
||||
<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/Levels/ControlTutorialLevel.umap" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Levels/ControlTutorialLevel.umap" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/Ships/BP_HomeShip.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Ships/BP_HomeShip.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Props/MaterialSphere.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Props/MaterialSphere.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/BountyClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/BountySystem/BountyClass.cpp" 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/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" />
|
||||
</list>
|
||||
@ -32,28 +40,28 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"C++ Project.EndlessVendetta.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "Bounty-System-Rework",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"C++ Project.EndlessVendetta.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "Bounty-System-Rework",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\Rafal\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\Rafal\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\Rafal\\AppData\\Local\\Symbols\\src"
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\Rafal\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\Rafal\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\Rafal\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="EndlessVendetta" type="CppProject" factoryName="C++ Project">
|
||||
<configuration_1>
|
||||
@ -128,7 +136,8 @@
|
||||
<workItem from="1705685813496" duration="6457000" />
|
||||
<workItem from="1705756768038" duration="3821000" />
|
||||
<workItem from="1705856571902" duration="3954000" />
|
||||
<workItem from="1706036726146" duration="5225000" />
|
||||
<workItem from="1706036726146" duration="5339000" />
|
||||
<workItem from="1706101472121" duration="11152000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
BIN
EndlessVendetta/Content/Ships/BP_HomeShip.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Ships/BP_HomeShip.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Props/MaterialSphere.uasset
(Stored with Git LFS)
Binary file not shown.
@ -11,18 +11,14 @@ ABountyClass::ABountyClass()
|
||||
|
||||
}
|
||||
|
||||
void ABountyClass::BeginPlay()
|
||||
void ABountyClass::ActivateFirstCheckpoint()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
SpawnCheckpoints();
|
||||
|
||||
}
|
||||
|
||||
void ABountyClass::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
if (BountyCheckpoints.IsEmpty() || BountyCheckpoints[0] == nullptr) return;
|
||||
|
||||
BountyCheckpoints[0]->Active = true;
|
||||
BountyCheckpoints[0]->SpawnWaypoint(BountyTitle);
|
||||
BountyCheckpoints[0]->CheckpointActivated();
|
||||
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
||||
}
|
||||
|
||||
void ABountyClass::SpawnCheckpoints()
|
||||
@ -46,49 +42,45 @@ void ABountyClass::SpawnCheckpoints()
|
||||
BountyCheckpoints.Add(SpawnedCheckpoint);
|
||||
}
|
||||
|
||||
// Activate the first checkpoint and listen for its completion
|
||||
BountyCheckpoints[0]->Active = true;
|
||||
BountyCheckpoints[0]->SpawnWaypoint(BountyTitle);
|
||||
BountyCheckpoints[0]->CheckpointActivated();
|
||||
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
||||
ActivateFirstCheckpoint();
|
||||
}
|
||||
|
||||
void ABountyClass::IncrementBountyCheckpoint()
|
||||
{
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
// Broadcast that the first Checkpoint has been completed so that side bounties can be destroyed
|
||||
if (!BountyStarted)
|
||||
{
|
||||
BountyStarted = true;
|
||||
CompletedFirstCheckpoint.Broadcast();
|
||||
}
|
||||
// if (!BountyStarted)
|
||||
// {
|
||||
// BountyStarted = true;
|
||||
// CompletedFirstCheckpoint.Broadcast();
|
||||
// }
|
||||
//
|
||||
// // Bounty Completion Condition
|
||||
// if (BountyCheckpoints.Num() <= 1)
|
||||
// {
|
||||
// Completed = true;
|
||||
// BountyCheckpoints[0]->Active = false;
|
||||
// BountyCheckpoints[0]->Destroy();
|
||||
// BountyCheckpoints.RemoveAt(0);
|
||||
// UE_LOG(LogTemp, Warning, TEXT(" You've Completed the Bounty!! Well done"));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (BountyCheckpoints[0] == nullptr)
|
||||
// {
|
||||
// UE_LOG(LogTemp, Fatal, TEXT("Missing checkpoint in bounty checkpoints, could've failed to spawn or cast"));
|
||||
// return;
|
||||
// }
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Bounty Completion Condition
|
||||
if (BountyCheckpoints.Num() <= 1)
|
||||
{
|
||||
Completed = true;
|
||||
BountyCheckpoints[0]->Active = false;
|
||||
BountyCheckpoints[0]->Destroy();
|
||||
BountyCheckpoints.RemoveAt(0);
|
||||
UE_LOG(LogTemp, Warning, TEXT(" You've Completed the Bounty!! Well done"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (BountyCheckpoints[0] == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Fatal, TEXT("Missing checkpoint in bounty checkpoints, could've failed to spawn or cast"));
|
||||
return;
|
||||
}
|
||||
if (BountyCheckpoints.IsEmpty() || BountyCheckpoints[0] == nullptr) return;
|
||||
|
||||
// Destroy Actor and Shrink Array
|
||||
BountyCheckpoints[0]->Active = false;
|
||||
BountyCheckpoints[0]->Destroy();
|
||||
BountyCheckpoints.RemoveAt(0);
|
||||
|
||||
// Set the new checkpoint in pos 0 to be active and listen for it's completion
|
||||
BountyCheckpoints[0]->Active = true;
|
||||
BountyCheckpoints[0]->SpawnWaypoint(BountyTitle);
|
||||
BountyCheckpoints[0]->CheckpointActivated();
|
||||
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
|
||||
ActivateFirstCheckpoint();
|
||||
}
|
||||
|
||||
void ABountyClass::CollectRewards_Implementation()
|
||||
|
@ -14,15 +14,53 @@ class ENDLESSVENDETTA_API ABountyClass : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Used to temp store value of incoming replacement checkpoint class
|
||||
TSubclassOf<ACheckpointClass> ReplacementCheckpointClass;
|
||||
// ------------------- ATTRIBUTES ------------------------------
|
||||
|
||||
// Array of Checkpoint Classes to Spawn for this Bounty
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
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:
|
||||
|
||||
|
||||
// ------------------- METHODS ---------------------------------
|
||||
private:
|
||||
// Activate the First Checkpoint in Bounty Checkpoints and Listen for its Completion
|
||||
void ActivateFirstCheckpoint();
|
||||
|
||||
protected:
|
||||
// Called when a checkpoint is completed, handles moving onto next checkpoint and discarding the old one
|
||||
UFUNCTION()
|
||||
virtual void IncrementBountyCheckpoint();
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
ABountyClass();
|
||||
|
||||
// Spawns and stores this Bounties Checkpoints in order
|
||||
void SpawnCheckpoints();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------- LEGACY CODE TO BE REWORKED ---------------------------------
|
||||
|
||||
|
||||
bool BountyStarted = false;
|
||||
|
||||
protected:
|
||||
// ------- Properties Set in Editor --------------
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
TArray<TSubclassOf<ACheckpointClass>> CheckpointsToSpawn;
|
||||
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
int RewardMoney = 0;
|
||||
@ -34,22 +72,16 @@ protected:
|
||||
FString BountyDesc;
|
||||
// -----------------------------------------------
|
||||
|
||||
bool Completed = false;
|
||||
|
||||
// Spawned in Checkpoints for this Bounty
|
||||
TArray<ACheckpointClass*> BountyCheckpoints;
|
||||
|
||||
// Spawns and stores this Bounties Checkpoints in order
|
||||
void SpawnCheckpoints();
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
|
||||
public:
|
||||
// Broadcast when first checkpoint from this bounty is completed
|
||||
FCompletedFirstCheckpoint CompletedFirstCheckpoint;
|
||||
|
||||
|
||||
|
||||
// ------ Getters for Bounty and Checkpoint Properties ------
|
||||
bool IsCompleted()
|
||||
{
|
||||
@ -103,15 +135,6 @@ public:
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
// Sets default values for this actor's properties
|
||||
ABountyClass();
|
||||
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
// Called when a checkpoint is completed, handles moving onto next checkpoint and discarding the old one
|
||||
UFUNCTION()
|
||||
virtual void IncrementBountyCheckpoint();
|
||||
|
||||
// Collect Money in C++, any other special reward will be implemented in BP if neccessary
|
||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||
|
@ -15,8 +15,46 @@ class ENDLESSVENDETTA_API AMainBountyClass : public ABountyClass
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// ------------------- ATTRIBUTES ------------------------------
|
||||
// Used to Spawn Open World Checkpoint for this Main Bounty
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
TSubclassOf<ACheckpointClass> OpenWorldCheckpointClass;
|
||||
|
||||
// Only Function of this Checkpoint is to Guide the Player to the Bounty Start Area
|
||||
ACheckpointClass* OpenWorldCheckpointRef;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// ------------------- METHODS ---------------------------------
|
||||
private:
|
||||
// Overrides to Display Correct Tip for Checkpoint
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------- LEGACY CODE TO BE REWORKED ---------------------------------
|
||||
protected:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
|
||||
TArray<TSubclassOf<ASideBountyClass>> SideBountiesToSpawn;
|
||||
@ -48,6 +86,8 @@ public:
|
||||
return SideBountiesToSpawn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------- Custom Bounty Alterations -------------
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Bounty")
|
||||
void ActivateCustomBountyAlteration_1();
|
||||
|
@ -3,9 +3,21 @@
|
||||
|
||||
#include "BountyHunterCharacter.h"
|
||||
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void ABountyHunterCharacter::SpawnBounties()
|
||||
{
|
||||
if (MainBountyClasses.IsEmpty() || !IsValid(MainBountyClasses[CurrentMainBountyIndex])) return;
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("Spawning Bounty..."));
|
||||
|
||||
UGameplayStatics::save
|
||||
|
||||
CurrentMainBounty = GetWorld()->SpawnActor<AMainBountyClass>(MainBountyClasses[CurrentMainBountyIndex]);
|
||||
const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, true);
|
||||
AttachToComponent(GetRootComponent(), AttachmentTransformRules);
|
||||
|
||||
UGameplayStatics::GetCurrentLevelName(GetWorld()) == OpenWorldLevelName ? CurrentMainBounty->SpawnOpenWorldCheckpoint() : CurrentMainBounty->SpawnCheckpoints();
|
||||
}
|
||||
|
||||
void ABountyHunterCharacter::CompleteCurrentMainBounty()
|
||||
@ -15,6 +27,7 @@ void ABountyHunterCharacter::CompleteCurrentMainBounty()
|
||||
|
||||
void ABountyHunterCharacter::BeginPlay()
|
||||
{
|
||||
SpawnBounties();
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||
#include "EndlessVendetta/BountySystem/MainBountyClass.h"
|
||||
#include "BountyHunterCharacter.generated.h"
|
||||
|
||||
/**
|
||||
@ -21,11 +22,15 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac
|
||||
|
||||
// Reference to the Currently Active Main Bounty
|
||||
UPROPERTY(VisibleAnywhere, Category = "Bounty Hunter")
|
||||
AMainBountyClass* ActiveMainBounty;
|
||||
AMainBountyClass* CurrentMainBounty;
|
||||
|
||||
// Index of Currently Active Main Bounty, Used for MainBountyClasses
|
||||
int CurrentMainBountyIndex = 0;
|
||||
|
||||
// Name of open world, so that the correct bounties can be spawned based on level
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
|
||||
FString OpenWorldLevelName = "ControlTutorialLevel";
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -34,7 +39,7 @@ public:
|
||||
|
||||
// ------------------- METHODS ---------------------------------
|
||||
private:
|
||||
// Spawns Main Bounty from MainBountyClasses at the CurrentMainBountyIndex, along with its Side Bounties
|
||||
// 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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user