SkyPortal-plugin/Source/SkyPortal/Public/SkyPortalRunner.h

43 lines
959 B
C
Raw Normal View History

2024-09-24 22:17:52 +00:00
#pragma once
2024-11-24 19:44:59 +00:00
#include "SkyPortalDefinitions.h"
2024-09-24 22:17:52 +00:00
#include "HAL/Runnable.h"
2024-09-25 15:33:25 +00:00
2024-09-24 22:17:52 +00:00
class FPortalStatusChecker : public FRunnable {
public:
2024-09-25 15:33:25 +00:00
/* Constructor : pass the subsystem and desired check interval(in seconds)
*
* @param InSubsystem Should always be the SkyPortalSubsystem
*/
FPortalStatusChecker(UEngineSubsystem* InSubsystem, float InCheckInterval);
2024-09-24 22:17:52 +00:00
// FRunnable interface
virtual bool Init() override;
virtual uint32 Run() override;
virtual void Stop() override;
virtual void Exit() override;
2024-09-25 22:19:16 +00:00
UPROPERTY(BlueprintReadOnly)
FPortalStatusData CurrentStatusData;
2024-09-25 11:47:11 +00:00
2024-09-25 22:19:16 +00:00
UPROPERTY(BlueprintReadOnly)
FPortalStatusData OldStatusData;
2024-09-25 11:47:11 +00:00
2024-09-24 22:17:52 +00:00
private:
// Pointer to the subsystem that contains PortalStatus()
2024-09-25 15:33:25 +00:00
UEngineSubsystem* SkyPortalSubsystemRef;
2024-09-24 22:17:52 +00:00
// Time interval (in seconds) for status checking
float CheckInterval;
// Thread control variables
FThreadSafeBool bShouldRun;
// Helper function to check portal status
void CheckPortalStatus();
};