AzureAbyss/Source/the_twilight_abyss/Quest/QuestSystem.h

53 lines
1.4 KiB
C
Raw Normal View History

2023-03-13 05:19:13 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
2023-03-13 18:11:42 +00:00
#include "Components/TextBlock.h"
#include "Blueprint/UserWidget.h"
2023-03-29 16:36:24 +00:00
#include "Quest.h"
2023-05-02 04:42:48 +00:00
#include "UWorldState.h"
#include "../BaseItems/InventoryComponent.h"
2023-03-13 05:19:13 +00:00
#include "QuestSystem.generated.h"
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class THE_TWILIGHT_ABYSS_API UQuestSystem : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UQuestSystem();
2023-05-02 04:42:48 +00:00
UPROPERTY(EditAnywhere, BlueprintReadOnly)
2023-03-29 16:36:24 +00:00
TArray<UQuest*> ActiveQuests;
2023-05-02 04:42:48 +00:00
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
2023-03-29 16:36:24 +00:00
TArray<UQuest*> CompletedQuests;
2023-05-02 04:42:48 +00:00
UPROPERTY(EditAnywhere)
2023-03-29 16:36:24 +00:00
TMap<FString, bool> QuestFlags;
2023-03-13 05:19:13 +00:00
protected:
// Called when the game starts
virtual void BeginPlay() override;
2023-03-13 18:11:42 +00:00
UPROPERTY()
TSubclassOf<UUserWidget> QuestWidget;
2023-03-29 16:36:24 +00:00
FJsonObject WorldStateJsonTemplate;
2023-03-13 05:19:13 +00:00
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
2023-03-29 16:36:24 +00:00
void CheckActiveQuestConditions();
2023-05-02 04:42:48 +00:00
UWorldState* GetWorldState() const;
UFUNCTION(BlueprintCallable)
void AddQuest(UQuest* Quest);
UFUNCTION(BlueprintCallable)
void AddQuestFlag(FString FlagName, bool FlagValue);
private:
UInventoryComponent* PlayerInventory;
2023-03-13 05:19:13 +00:00
};