Download LyraStarterGame/Source/LyraGame/GameModes/LyraGameState.h from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 3.73 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/GameModes/LyraGameState.h
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/GameModes/LyraGameState.h
-
curl -L -o LyraGameState.h https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/GameModes/LyraGameState.h
3.73 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| struct FLyraVerbMessage; | |
| class APlayerState; | |
| class UAbilitySystemComponent; | |
| class ULyraAbilitySystemComponent; | |
| class ULyraExperienceManagerComponent; | |
| class UObject; | |
| struct FFrame; | |
| /** | |
| * ALyraGameState | |
| * | |
| * The base game state class used by this project. | |
| */ | |
| UCLASS(MinimalAPI, Config = Game) | |
| class ALyraGameState : public AModularGameStateBase, public IAbilitySystemInterface | |
| { | |
| GENERATED_BODY() | |
| public: | |
| UE_API ALyraGameState(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); | |
| //~AActor interface | |
| UE_API virtual void PreInitializeComponents() override; | |
| UE_API virtual void PostInitializeComponents() override; | |
| UE_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; | |
| UE_API virtual void Tick(float DeltaSeconds) override; | |
| //~End of AActor interface | |
| //~AGameStateBase interface | |
| UE_API virtual void AddPlayerState(APlayerState* PlayerState) override; | |
| UE_API virtual void RemovePlayerState(APlayerState* PlayerState) override; | |
| UE_API virtual void SeamlessTravelTransitionCheckpoint(bool bToTransitionMap) override; | |
| //~End of AGameStateBase interface | |
| //~IAbilitySystemInterface | |
| UE_API virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override; | |
| //~End of IAbilitySystemInterface | |
| // Gets the ability system component used for game wide things | |
| 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") | |
| UE_API 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") | |
| UE_API void MulticastReliableMessageToClients(const FLyraVerbMessage Message); | |
| // Gets the server's FPS, replicated to clients | |
| UE_API float GetServerFPS() const; | |
| // Indicate the local player state is recording a replay | |
| UE_API void SetRecorderPlayerState(APlayerState* NewPlayerState); | |
| // Gets the player state that recorded the replay, if valid | |
| UE_API APlayerState* GetRecorderPlayerState() const; | |
| // Delegate called when the replay player state changes | |
| DECLARE_MULTICAST_DELEGATE_OneParam(FOnRecorderPlayerStateChanged, APlayerState*); | |
| FOnRecorderPlayerStateChanged OnRecorderPlayerStateChangedEvent; | |
| private: | |
| // Handles loading and managing the current gameplay experience | |
| UPROPERTY() | |
| TObjectPtr<ULyraExperienceManagerComponent> ExperienceManagerComponent; | |
| // The ability system component subobject for game-wide things (primarily gameplay cues) | |
| UPROPERTY(VisibleAnywhere, Category = "Lyra|GameState") | |
| TObjectPtr<ULyraAbilitySystemComponent> AbilitySystemComponent; | |
| protected: | |
| UPROPERTY(Replicated) | |
| float ServerFPS; | |
| // The player state that recorded a replay, it is used to select the right pawn to follow | |
| // This is only set in replay streams and is not replicated normally | |
| UPROPERTY(Transient, ReplicatedUsing = OnRep_RecorderPlayerState) | |
| TObjectPtr<APlayerState> RecorderPlayerState; | |
| UFUNCTION() | |
| UE_API void OnRep_RecorderPlayerState(); | |
| }; | |