Added Quest System Stub
This commit is contained in:
parent
c0ff4f6b9f
commit
f57960bed6
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Source/the_twilight_abyss/Quest/FWorldState.h
Normal file
BIN
Source/the_twilight_abyss/Quest/FWorldState.h
Normal file
Binary file not shown.
20
Source/the_twilight_abyss/Quest/Quest.cpp
Normal file
20
Source/the_twilight_abyss/Quest/Quest.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Quest.h"
|
||||||
|
|
||||||
|
bool UQuest::CheckConditions(FJsonObject WorldState)
|
||||||
|
{
|
||||||
|
if (Conditions.Values.IsEmpty()) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UQuest::CheckPreConditions(FJsonObject WorldState)
|
||||||
|
{
|
||||||
|
if (PreConditions.Values.IsEmpty()) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UQuest::ApplyRewards()
|
||||||
|
{
|
||||||
|
}
|
31
Source/the_twilight_abyss/Quest/Quest.h
Normal file
31
Source/the_twilight_abyss/Quest/Quest.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "UObject/NoExportTypes.h"
|
||||||
|
#include "../PlayerTemp/TempCharacter.h"
|
||||||
|
#include "Quest.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class THE_TWILIGHT_ABYSS_API UQuest : public UObject
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
public:
|
||||||
|
FText Title;
|
||||||
|
FText Description;
|
||||||
|
FString QuestLine;
|
||||||
|
UQuest* ParentQuest;
|
||||||
|
FJsonObject Conditions;
|
||||||
|
FJsonObject PreConditions;
|
||||||
|
|
||||||
|
//TODO: Rewards
|
||||||
|
|
||||||
|
bool CheckConditions(FJsonObject WorldState);
|
||||||
|
bool CheckPreConditions(FJsonObject WorldState);
|
||||||
|
void ApplyRewards();
|
||||||
|
//TODO: CreateQuest
|
||||||
|
};
|
@ -32,3 +32,21 @@ void UQuestSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UQuestSystem::CheckActiveQuestConditions()
|
||||||
|
{
|
||||||
|
for (UQuest* Quest : ActiveQuests)
|
||||||
|
{
|
||||||
|
if (Quest->CheckConditions(GetWorldState()))
|
||||||
|
{
|
||||||
|
CompletedQuests.Add(Quest);
|
||||||
|
Quest->ApplyRewards();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FJsonObject UQuestSystem::GetWorldState()
|
||||||
|
{
|
||||||
|
FJsonObject WorldState = FJsonObject();
|
||||||
|
return WorldState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,17 +6,9 @@
|
|||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "Quest.h"
|
||||||
#include "QuestSystem.generated.h"
|
#include "QuestSystem.generated.h"
|
||||||
|
|
||||||
// UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
|
||||||
// class UQuest : public UObject
|
|
||||||
// {
|
|
||||||
// GENERATED_BODY()
|
|
||||||
//
|
|
||||||
// public:
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
|
|
||||||
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
||||||
class THE_TWILIGHT_ABYSS_API UQuestSystem : public UActorComponent
|
class THE_TWILIGHT_ABYSS_API UQuestSystem : public UActorComponent
|
||||||
{
|
{
|
||||||
@ -26,6 +18,11 @@ public:
|
|||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UQuestSystem();
|
UQuestSystem();
|
||||||
|
|
||||||
|
TArray<UQuest*> ActiveQuests;
|
||||||
|
TArray<UQuest*> CompletedQuests;
|
||||||
|
TArray<FString> CompletedQuestLines;
|
||||||
|
TMap<FString, bool> QuestFlags;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
@ -33,7 +30,11 @@ protected:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TSubclassOf<UUserWidget> QuestWidget;
|
TSubclassOf<UUserWidget> QuestWidget;
|
||||||
|
|
||||||
|
FJsonObject WorldStateJsonTemplate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
void CheckActiveQuestConditions();
|
||||||
|
FJsonObject GetWorldState();
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules
|
|||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule", "Json" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user