Space Plunder
Loading...
Searching...
No Matches
GameStateComponentBase.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Components/ActorComponent.h"
8#include "GameFramework/GameStateBase.h"
9#include "GameStateComponentBase.generated.h"
10
11
12enum class EMatchState : uint8;
13struct FMatchState;
14
15UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent), Abstract)
16class BASEHELPERS_API UGameStateComponentBase : public UCommonActorComponent
17{
18 GENERATED_BODY()
19
20public:
21 UGameStateComponentBase();
22
23
25 template <class T>
26 T* GetGameState() const
27 {
28 static_assert(TPointerIsConvertibleFromTo<T, AGameStateBase>::Value, "'T' template parameter to GetGameState must be derived from AGameStateBase");
29 return Cast<T>(GetOwner());
30 }
31 template <class T>
32 T* GetGameStateChecked() const
33 {
34 static_assert(TPointerIsConvertibleFromTo<T, AGameStateBase>::Value, "'T' template parameter to GetGameStateChecked must be derived from AGameStateBase");
35 return CastChecked<T>(GetOwner());
36 }
38 template <class T>
39 T* GetGameMode() const
40 {
41 static_assert(TPointerIsConvertibleFromTo<T, AGameModeBase>::Value, "'T' template parameter to GetGameMode must be derived from AGameModeBase");
42 return Cast<T>(GetGameStateChecked<AGameStateBase>()->AuthorityGameMode);
43 }
44
46 virtual void HandleMatchHasStarted() {}
47
49 UFUNCTION()
50 virtual void OnGameStateUpdated(const FMatchState& MatchState);
52 UFUNCTION()
53 virtual void OnMultiplayerStateUpdated(const EMatchState State);
54
55
56 virtual bool PlayerAdded(APlayerState* PlayerState);
57 virtual bool PlayerRemoved(APlayerState* PlayerState);
58
59protected:
60 virtual void BeginPlay() override;
61
62
63
64
65private:
66
67
68
69};
EMatchState
Definition BaseData.h:1065
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition BaseData.h:1077