Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "Engine/GameInstance.h"
  6. #include "StateManager.generated.h"
  7.  
  8. //enum of top level states
  9. UENUM(BlueprintType)
  10. enum class EGameState : uint8 {
  11.     ENone           UMETA(DisplayName = "None"),
  12.     EStartup        UMETA(DisplayName = "Startup"),
  13.     ELoginScreen    UMETA(DisplayName = "LoginScreen"),
  14. };
  15. /**
  16.  *
  17.  */
  18. UCLASS()
  19. class GSTUT_API UStateManager : public UGameInstance
  20. {
  21.     GENERATED_BODY()
  22.    
  23. public:
  24.  
  25.     //To reference Login menu Class
  26.     UPROPERTY(EditDefaultsOnly, Category = "State Manager")
  27.         TSubclassOf<class UUserWidget> cLoginMenu;
  28.  
  29.     //Init() works like contructor for Game Instance
  30.     virtual void Init() override;
  31.  
  32.     //public function for handling state changes
  33.     UFUNCTION(BlueprintCallable, Category = "State Manager")
  34.         void ChangeState(EGameState newState);
  35.  
  36.     //returns current game state
  37.     EGameState GetGameState();
  38.  
  39.     /* GameSparks calls */
  40.     void Login(FString username, FString password);
  41.     void Register(FString username, FString password);
  42.     /* End GameSparks */
  43. private:
  44.  
  45.     //currently displayed widget
  46.     UUserWidget *currentWidget;
  47.  
  48.     //Current Game State
  49.     EGameState currentState;
  50.  
  51.     void EnterState(EGameState newState);
  52.     void LeaveState(EGameState oldState);
  53.  
  54.    
  55.    
  56. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement