Agrarsense
AgrarsenseStatics.cpp
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#include "AgrarsenseStatics.h"
7
8#include "ROSIntegration/Classes/ROSIntegrationGameInstance.h"
9
20
21#include "Engine/GameViewportClient.h"
22#include "Engine/Engine.h"
23#include "Engine/World.h"
24
26{
27 return Cast<AAgrarsenseGameModeBase>(UGameplayStatics::GetGameMode(WorldContextObject));
28}
29
31{
32 return Cast<UAgrarsenseGameInstance>(UGameplayStatics::GetGameInstance(WorldContextObject));
33}
34
35UROSIntegrationGameInstance* UAgrarsenseStatics::GetROSGameInstance(const UObject* WorldContextObject)
36{
37 return Cast<UROSIntegrationGameInstance>(UGameplayStatics::GetGameInstance(WorldContextObject));
38}
39
40ALidarManager* UAgrarsenseStatics::GetLidarManager(const UObject* WorldContextObject)
41{
42 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
43 return GameMode != nullptr ? GameMode->GetLidarManager() : nullptr;
44}
45
46UROSHandler* UAgrarsenseStatics::GetROSHandle(const UObject* WorldContextObject)
47{
48 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
49 return GameMode != nullptr ? GameMode->GetROSHandle() : nullptr;
50}
51
53{
54 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
55 return GameMode != nullptr ? GameMode->GetInstancedRenderer() : nullptr;
56}
57
58AWeather* UAgrarsenseStatics::GetWeatherActor(const UObject* WorldContextObject)
59{
60 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
61 return GameMode != nullptr ? GameMode->GetWeatherActor() : nullptr;
62}
63
64ASpectator* UAgrarsenseStatics::GetSpectator(const UObject* WorldContextObject)
65{
66 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
67 return GameMode != nullptr ? GameMode->GetSpectator() : nullptr;
68}
69
71{
72 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
73 return GameMode != nullptr ? GameMode->GetSimulationLevelManager() : nullptr;
74}
75
77{
78 UWorld* World = nullptr;
79 if (GEngine && GEngine->GameViewport)
80 {
81 World = GEngine->GameViewport->GetWorld();
82 }
83
84 return World;
85}
86
88{
89 return USensorManager::Get();
90}
91
93{
95}
ASimulationLevelManager * GetSimulationLevelManager()
AInstancedRendererManager * GetInstancedRenderer()
ALidarManager * GetLidarManager()
static UAgrarsenseSettings * GetAgrarsenseSettings()
static USensorManager * GetSensorManager()
static ASpectator * GetSpectator(const UObject *WorldContextObject)
static UAgrarsenseSettings * GetAgrarsenseSettings()
static AAgrarsenseGameModeBase * GetGameMode(const UObject *WorldContextObject)
static AWeather * GetWeatherActor(const UObject *WorldContextObject)
static UROSIntegrationGameInstance * GetROSGameInstance(const UObject *WorldContextObject)
static ALidarManager * GetLidarManager(const UObject *WorldContextObject)
static UAgrarsenseGameInstance * GetGameInstance(const UObject *WorldContextObject)
static ASimulationLevelManager * GetSimulationLevelManager(const UObject *WorldContextObject)
static AInstancedRendererManager * GetInstancedRenderer(const UObject *WorldContextObject)
static UWorld * GetWorldStatic()
static UROSHandler * GetROSHandle(const UObject *WorldContextObject)
static USensorManager * Get()