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
21
22#include "Engine/GameViewportClient.h"
23#include "Engine/Engine.h"
24#include "Engine/World.h"
25
27{
28 return Cast<AAgrarsenseGameModeBase>(UGameplayStatics::GetGameMode(WorldContextObject));
29}
30
32{
33 return Cast<UAgrarsenseGameInstance>(UGameplayStatics::GetGameInstance(WorldContextObject));
34}
35
36UROSIntegrationGameInstance* UAgrarsenseStatics::GetROSGameInstance(const UObject* WorldContextObject)
37{
38 return Cast<UROSIntegrationGameInstance>(UGameplayStatics::GetGameInstance(WorldContextObject));
39}
40
41ALidarManager* UAgrarsenseStatics::GetLidarManager(const UObject* WorldContextObject)
42{
43 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
44 return GameMode != nullptr ? GameMode->GetLidarManager() : nullptr;
45}
46
47UROSHandler* UAgrarsenseStatics::GetROSHandle(const UObject* WorldContextObject)
48{
49 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
50 return GameMode != nullptr ? GameMode->GetROSHandle() : nullptr;
51}
52
54{
55 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
56 return GameMode != nullptr ? GameMode->GetInstancedRenderer() : nullptr;
57}
58
59AWeather* UAgrarsenseStatics::GetWeatherActor(const UObject* WorldContextObject)
60{
61 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
62 return GameMode != nullptr ? GameMode->GetWeatherActor() : nullptr;
63}
64
65ASpectator* UAgrarsenseStatics::GetSpectator(const UObject* WorldContextObject)
66{
67 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
68 return GameMode != nullptr ? GameMode->GetSpectator() : nullptr;
69}
70
72{
73 AAgrarsenseGameModeBase* GameMode = GetGameMode(WorldContextObject);
74 return GameMode != nullptr ? GameMode->GetSimulationLevelManager() : nullptr;
75}
76
78{
79 UWorld* World = nullptr;
80 if (GEngine && GEngine->GameViewport)
81 {
82 World = GEngine->GameViewport->GetWorld();
83 }
84
85 return World;
86}
87
89{
90 return USensorManager::Get();
91}
92
94{
96}
ASimulationLevelManager * GetSimulationLevelManager()
AInstancedRenderer * 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 AInstancedRenderer * GetInstancedRenderer(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 UWorld * GetWorldStatic()
static UROSHandler * GetROSHandle(const UObject *WorldContextObject)
static USensorManager * Get()