Agrarsense
AgrarsenseGameModeBase.h
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#pragma once
7
8#include "CoreMinimal.h"
9#include "GameFramework/GameModeBase.h"
10#include "Blueprint/UserWidget.h"
11#include "Templates/SubclassOf.h"
12
14
15#include "AgrarsenseGameModeBase.generated.h"
16
18class UROSCommands;
19class UROSHandler;
20
22class ALidarManager;
23class ASpectator;
24class AWeather;
25class ATagger;
26
27UCLASS()
28class AGRARSENSE_API AAgrarsenseGameModeBase : public AGameModeBase
29{
30
31 GENERATED_BODY()
32
33public:
34
35 AAgrarsenseGameModeBase(const FObjectInitializer& ObjectInitializer);
36
41 UFUNCTION(BlueprintCallable)
42 ALidarManager* GetLidarManager()
43 {
44 return LidarManager;
45 }
46
51 UFUNCTION(BlueprintCallable)
52 UROSHandler* GetROSHandle()
53 {
54 return ROSHandle;
55 }
56
61 UFUNCTION(BlueprintCallable, BlueprintPure)
62 ASimulationLevelManager* GetSimulationLevelManager()
63 {
64 return SimulationLevelManager;
65 }
66
71 UFUNCTION(BlueprintCallable, BlueprintPure)
72 AInstancedRenderer* GetInstancedRenderer()
73 {
74 return InstancedRenderer;
75 }
76
81 UFUNCTION(BlueprintCallable, BlueprintPure)
82 AWeather* GetWeatherActor()
83 {
84 return Weather;
85 }
86
91 UFUNCTION(BlueprintCallable, BlueprintPure)
92 ASpectator* GetSpectator()
93 {
94 return Spectator;
95 }
96
101 UFUNCTION(BlueprintCallable)
102 UROSCommands* GetROSCommands()
103 {
104 return ROSCommands;
105 }
106
111 UPROPERTY(Category = "Agrarsense Game Mode", EditAnywhere)
112 TSubclassOf<ALidarManager> LidarManagerClass;
113
118 UPROPERTY(Category = "Agrarsense Game Mode", EditAnywhere)
119 TSubclassOf<UUserWidget> DeveloperTools;
120
125 UPROPERTY(Category = "Agrarsense Game Mode", EditAnywhere)
126 TSubclassOf<ASimulationLevelManager> SimulationLevelManagerClass;
127
128protected:
129
133 void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
134
138 void BeginPlay() override;
139
143 void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
144
145private:
146
150 void ParseMapChangeLaunchArgument();
151
156 void SpawnNeededActorsInitGame();
157
162 void SpawnNeededActorsBeginPlay();
163
164#if WITH_EDITOR
165 void EditorEndPlayCleanup();
166#endif
167
170 static bool MapChanged;
171
172 UPROPERTY()
173 ALidarManager* LidarManager = nullptr;
174
175 UPROPERTY()
176 UROSHandler* ROSHandle = nullptr;
177
178 UPROPERTY()
179 ASimulationLevelManager* SimulationLevelManager = nullptr;
180
181 UPROPERTY()
182 AInstancedRenderer* InstancedRenderer = nullptr;
183
184 UPROPERTY()
185 AWeather* Weather = nullptr;
186
187 UPROPERTY()
188 UROSCommands* ROSCommands = nullptr;
189
190 UPROPERTY()
191 ASpectator* Spectator = nullptr;
192
193 UPROPERTY()
194 ATagger* Tagger = nullptr;
195
196};
Definition: Tagger.h:29
virtual void BeginPlay() override
Definition: Tagger.cpp:26
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
Definition: Tagger.cpp:54