-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefyingGravityGameMode.h
72 lines (49 loc) · 1.75 KB
/
DefyingGravityGameMode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Blueprint/UserWidget.h"
#include "GameFramework/GameMode.h"
#include "DefyingGravityGameMode.generated.h"
// The GameMode defines the game being played. It governs the game rules, scoring, what actors
// are allowed to exist in this game type, and who may enter the game.
//
// This game mode just sets the default pawn to be the MyCharacter asset, which is a subclass of DefyingGravityCharacter
UENUM(BlueprintType)
enum class DGPlayState
{
EMainMenu,
EPlaying,
EGameOver,
EWon,
EUnknown
};
UCLASS(minimalapi)
class ADefyingGravityGameMode : public AGameMode
{
GENERATED_BODY()
public:
ADefyingGravityGameMode();
virtual void Tick(float DeltaTime) override;
virtual void BeginPlay() override;
/** Remove the current menu widget and create a new one from the specified class, if provided. */
UFUNCTION(BlueprintCallable, Category = "UMG Game")
void ChangeMenuWidget(TSubclassOf<UUserWidget> NewWidgetClass);
/** Return the current playing state */
UFUNCTION(BlueprintPure, Category = "State")
DGPlayState getCurrentState() const;
/** Set a new playing state*/
UFUNCTION(BlueprintCallable, Category = "State")
void setCurrentState(DGPlayState newState);
int32 getInstage();
void setInstage(int32 newstage);
protected:
/** The widget class we will use as our menu when the game starts. */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UMG Game")
TSubclassOf<UUserWidget> StartingWidgetClass;
/** The widget instance that we are using as our menu. */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UMG Game")
UUserWidget* CurrentWidget;
int32 inStage;
private:
/** Keep track of the current playing state */
DGPlayState currentState;
};