Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #pragma once
- #include "Engine/GameInstance.h"
- #include "StateManager.generated.h"
- //enum of top level states
- UENUM(BlueprintType)
- enum class EGameState : uint8 {
- ENone UMETA(DisplayName = "None"),
- EStartup UMETA(DisplayName = "Startup"),
- ELoginScreen UMETA(DisplayName = "LoginScreen"),
- };
- /**
- *
- */
- UCLASS()
- class GSTUT_API UStateManager : public UGameInstance
- {
- GENERATED_BODY()
- public:
- //To reference Login menu Class
- UPROPERTY(EditDefaultsOnly, Category = "State Manager")
- TSubclassOf<class UUserWidget> cLoginMenu;
- //Init() works like contructor for Game Instance
- virtual void Init() override;
- //public function for handling state changes
- UFUNCTION(BlueprintCallable, Category = "State Manager")
- void ChangeState(EGameState newState);
- //returns current game state
- EGameState GetGameState();
- /* GameSparks calls */
- void Login(FString username, FString password);
- void Register(FString username, FString password);
- /* End GameSparks */
- private:
- //currently displayed widget
- UUserWidget *currentWidget;
- //Current Game State
- EGameState currentState;
- void EnterState(EGameState newState);
- void LeaveState(EGameState oldState);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement