#pragma once #include "CoreMinimal.h" #include "Core/DescentHandle.h" #include "Core/DescentWorldSubsystem.h" #include "UI/DescentHudModel.h" #include "DescentHudSubsystem.generated.h" /** * Owns the one FDescentHudModel of the world. The seam between the systems that know things and the UI that draws: * * // a gameplay system, from a callback on EDescentLateStep::HudModel (or anywhere on the game thread): * FDescentHudModel& Hud = UDescentHudSubsystem::Get(World)->Model(); * Hud.DepthM = Descent::DepthOfZ(RefPointM.Z); * Hud.DepthText = FDescentHudModel::FormatDepth(Hud.DepthM); * * // the UI track: * const FDescentHudModel& Hud = UDescentHudSubsystem::Get(World)->Model(); // draw it * * The subsystem itself only counts down toasts and the radio line (once per late step, before the writers run) and * registers the `ui.hud` part of the state dump. */ UCLASS() class THEDESCENT_API UDescentHudSubsystem : public UDescentWorldSubsystem { GENERATED_BODY() public: static UDescentHudSubsystem* Get(const UWorld* World); virtual void Initialize(FSubsystemCollectionBase& Collection) override; virtual void Deinitialize() override; FDescentHudModel& Model() { return HudModel; } const FDescentHudModel& Model() const { return HudModel; } /** Late steps this model has seen (proves the housekeeping runs). */ int64 HousekeepingCount() const { return Housekeeping; } private: FDescentHudModel HudModel; FDescentHandle StepHandle; int64 Housekeeping = 0; };