60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Subsystems/WorldSubsystem.h"
|
|
#include "PwnGameplayModeSubsystem.generated.h"
|
|
|
|
class APwnCombatPlatformerPath;
|
|
|
|
UENUM(BlueprintType, DisplayName = "Gameplay Mode")
|
|
enum class EPwnGameplayMode : uint8 {
|
|
Narrative,
|
|
Combat
|
|
};
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGameplayModeChangedDelegate, EPwnGameplayMode, NewMode);
|
|
|
|
UCLASS(DisplayName="Gameplay Mode Subsystem")
|
|
class PAWN_API UPwnGameplayModeSubsystem : public UWorldSubsystem {
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
static UPwnGameplayModeSubsystem& Get(const UObject* WorldContextObject);
|
|
|
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
|
|
|
virtual void Deinitialize() override;
|
|
|
|
UFUNCTION(BlueprintCallable, Category="Gameplay Modes")
|
|
void SetGameplayMode(EPwnGameplayMode GameplayMode);
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Gameplay Modes")
|
|
EPwnGameplayMode GetCurrentGameplayMode() const;
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Gameplay Modes")
|
|
bool IsNarrativeMode() const;
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Gameplay Modes")
|
|
bool IsCombatMode() const;
|
|
|
|
UFUNCTION()
|
|
void RegisterCombatPath(APwnCombatPlatformerPath* CombatPath);
|
|
|
|
UFUNCTION()
|
|
void UnregisterCombatPath(APwnCombatPlatformerPath* CombatPath);
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
bool FindClosestCombatPathLocation(const FVector& Location, APwnCombatPlatformerPath*& OutCombatPath, FVector& ClosestLocation) const;
|
|
|
|
public:
|
|
UPROPERTY(BlueprintAssignable)
|
|
FGameplayModeChangedDelegate OnGameplayModeChanged;
|
|
|
|
private:
|
|
UPROPERTY()
|
|
EPwnGameplayMode CurrentGameplayMode;
|
|
|
|
UPROPERTY()
|
|
TArray<TObjectPtr<APwnCombatPlatformerPath>> CombatPaths;
|
|
};
|