You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
absg/Source/SpaceBattler/Public/StateMachineSubsystem.h

40 lines
804 B

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "StateMachineSubsystem.generated.h"
UENUM(BlueprintType)
enum class EGameState : uint8
{
MainMenu,
Battle,
BattleMenu,
GameOver,
Victory
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FStateChangedDelegate, EGameState, NewState);
/**
*
*/
UCLASS()
class SPACEBATTLER_API UStateMachineSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
UFUNCTION(BlueprintCallable)
bool ChangeState(EGameState NewState);
UPROPERTY(BlueprintAssignable)
FStateChangedDelegate StateChangedDelegate;
protected:
EGameState CurrentState;
};