RealtimeStyleTransferRuntime/Source/LyraGame/GameModes/LyraGameState.h

81 lines
2.6 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AbilitySystemInterface.h"
2022-09-13 07:18:28 +00:00
#include "Engine/EngineTypes.h"
2022-05-23 18:41:30 +00:00
#include "Messages/LyraVerbMessage.h"
2022-09-13 07:18:28 +00:00
#include "ModularGameState.h"
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
#include "LyraGameState.generated.h"
2022-09-13 07:18:28 +00:00
class APlayerState;
2022-05-23 18:41:30 +00:00
class UAbilitySystemComponent;
2022-09-13 07:18:28 +00:00
class ULyraAbilitySystemComponent;
class ULyraExperienceManagerComponent;
class UObject;
struct FFrame;
2022-05-23 18:41:30 +00:00
/**
* ALyraGameState
*
* The base game state class used by this project.
*/
UCLASS(Config = Game)
class LYRAGAME_API ALyraGameState : public AModularGameStateBase, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
ALyraGameState(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
float GetServerFPS() const { return ServerFPS; }
//~AActor interface
virtual void PreInitializeComponents() override;
virtual void PostInitializeComponents() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~End of AActor interface
//~AGameStateBase interface
virtual void AddPlayerState(APlayerState* PlayerState) override;
virtual void RemovePlayerState(APlayerState* PlayerState) override;
//~End of AGameStateBase interface
//~IAbilitySystemInterface
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
//~End of IAbilitySystemInterface
UFUNCTION(BlueprintCallable, Category = "Lyra|GameState")
ULyraAbilitySystemComponent* GetLyraAbilitySystemComponent() const { return AbilitySystemComponent; }
// Send a message that all clients will (probably) get
// (use only for client notifications like eliminations, server join messages, etc... that can handle being lost)
UFUNCTION(NetMulticast, Unreliable, BlueprintCallable, Category = "Lyra|GameState")
void MulticastMessageToClients(const FLyraVerbMessage Message);
// Send a message that all clients will be guaranteed to get
// (use only for client notifications that cannot handle being lost)
UFUNCTION(NetMulticast, Reliable, BlueprintCallable, Category = "Lyra|GameState")
void MulticastReliableMessageToClients(const FLyraVerbMessage Message);
private:
UPROPERTY()
2022-09-13 07:18:28 +00:00
TObjectPtr<ULyraExperienceManagerComponent> ExperienceManagerComponent;
2022-05-23 18:41:30 +00:00
// The ability system component subobject for game-wide things (primarily gameplay cues)
UPROPERTY(VisibleAnywhere, Category = "Lyra|GameState")
2022-09-13 07:18:28 +00:00
TObjectPtr<ULyraAbilitySystemComponent> AbilitySystemComponent;
2022-05-23 18:41:30 +00:00
protected:
virtual void Tick(float DeltaSeconds) override;
protected:
UPROPERTY(Replicated)
float ServerFPS;
};