Agrarsense
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ASimulationLevelManager Class Reference

#include <SimulationLevelManager.h>

Inheritance diagram for ASimulationLevelManager:
Inheritance graph
[legend]
Collaboration diagram for ASimulationLevelManager:
Collaboration graph
[legend]

Public Member Functions

 ASimulationLevelManager ()
 
ESimulationState GetSimulationState () const
 
void SetSimulationState (ESimulationState newState)
 
ESimulationPhase GetSimulationPhase () const
 
void SetSimulationPhase (ESimulationPhase newPhase)
 
USensorsManagerComponent * GetSensorsManager () const
 
AVehicleGetManuallyControlledVehicle ()
 
bool TakeManualControlOfVehicle (AVehicle *Vehicle)
 
void CeaseManualControlOfVehicle ()
 

Public Attributes

FSimulationStateChanged OnSimulationStateChanged
 
FSimulationPhaseChanged OnSimulationPhaseChanged
 
TArray< FLevelTeleportLocationTeleportLocations
 

Protected Member Functions

virtual void BeginPlay () override
 

Protected Attributes

TObjectPtr< USensorsManagerComponent > SensorsManager
 

Private Attributes

ESimulationState SimulationState
 
ESimulationPhase SimulationPhase
 
TObjectPtr< AVehicleManuallyControlledVehicle
 

Detailed Description

Manager for handling simulation level high level state, phase etc.

Definition at line 24 of file SimulationLevelManager.h.

Constructor & Destructor Documentation

◆ ASimulationLevelManager()

ASimulationLevelManager::ASimulationLevelManager ( )

Definition at line 13 of file SimulationLevelManager.cpp.

14{
15 PrimaryActorTick.bCanEverTick = false;
16 SensorsManager = CreateDefaultSubobject<USensorsManagerComponent>(TEXT("SensorsManagerComp"));
17}
TObjectPtr< USensorsManagerComponent > SensorsManager

References SensorsManager.

Member Function Documentation

◆ BeginPlay()

void ASimulationLevelManager::BeginPlay ( )
overrideprotectedvirtual

Definition at line 19 of file SimulationLevelManager.cpp.

20{
21 Super::BeginPlay();
22}

◆ CeaseManualControlOfVehicle()

void ASimulationLevelManager::CeaseManualControlOfVehicle ( )

Cease manual control of a vehicle

Definition at line 58 of file SimulationLevelManager.cpp.

59{
61 {
62 APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
63
64 if (PlayerController)
65 {
66 ASpectator* Spectator = UAgrarsenseStatics::GetSpectator(GetWorld());
67 if (Spectator)
68 {
69 PlayerController->Possess(Spectator);
70 }
71 }
72
75 }
76}
TObjectPtr< AVehicle > ManuallyControlledVehicle
void SetSimulationPhase(ESimulationPhase newPhase)
static ASpectator * GetSpectator(const UObject *WorldContextObject)

References UAgrarsenseStatics::GetSpectator(), ManuallyControlledVehicle, ManualVehicleControl, Normal, SetSimulationPhase(), and SimulationPhase.

◆ GetManuallyControlledVehicle()

AVehicle * ASimulationLevelManager::GetManuallyControlledVehicle ( )
inline

Get vehicle that is currently manually controlled by the player. Will return nullptr if not in manual control

Returns
Manually controlled vehicle

Definition at line 72 of file SimulationLevelManager.h.

73 {
75 }

◆ GetSensorsManager()

USensorsManagerComponent * ASimulationLevelManager::GetSensorsManager ( ) const
inline

Get sensor manager attached to this Vehicle

Returns
USensorsManagerComponent pointer

Definition at line 62 of file SimulationLevelManager.h.

63 {
64 return SensorsManager;
65 }

References AVehicle::SensorsManager.

Referenced by USimulatorJsonParser::SpawnSensorWorld().

◆ GetSimulationPhase()

ESimulationPhase ASimulationLevelManager::GetSimulationPhase ( ) const
inline

Get the current phase of simulation

Definition at line 40 of file SimulationLevelManager.h.

40{ return SimulationPhase; }

◆ GetSimulationState()

ESimulationState ASimulationLevelManager::GetSimulationState ( ) const
inline

Get the current state of simulation

Definition at line 33 of file SimulationLevelManager.h.

33{ return SimulationState; }

◆ SetSimulationPhase()

void ASimulationLevelManager::SetSimulationPhase ( ESimulationPhase  newPhase)

Definition at line 31 of file SimulationLevelManager.cpp.

32{
33 SimulationPhase = newPhase;
34
35 OnSimulationPhaseChanged.Broadcast(newPhase);
36}
FSimulationPhaseChanged OnSimulationPhaseChanged

References OnSimulationPhaseChanged, and SimulationPhase.

Referenced by CeaseManualControlOfVehicle(), and TakeManualControlOfVehicle().

◆ SetSimulationState()

void ASimulationLevelManager::SetSimulationState ( ESimulationState  newState)

Definition at line 24 of file SimulationLevelManager.cpp.

25{
26 SimulationState = newState;
27
28 OnSimulationStateChanged.Broadcast(newState);
29}
FSimulationStateChanged OnSimulationStateChanged

References OnSimulationStateChanged, and SimulationState.

◆ TakeManualControlOfVehicle()

bool ASimulationLevelManager::TakeManualControlOfVehicle ( AVehicle Vehicle)

Take manual control of a vehicle

Parameters
VehicleVehicle to possess
Returns
Was vehicle possessed

Definition at line 38 of file SimulationLevelManager.cpp.

39{
40 bool WasPossessed = false;
41
42 if (Vehicle)
43 {
45 APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
46
47 if (PlayerController)
48 {
49 PlayerController->Possess(Vehicle);
50 WasPossessed = true;
52 }
53 }
54
55 return WasPossessed;
56}

References ManuallyControlledVehicle, ManualVehicleControl, SetSimulationPhase(), and Vehicle.

Referenced by USimulatorJsonParser::TeleportSpectatorOrFollowActorIfField().

Member Data Documentation

◆ ManuallyControlledVehicle

TObjectPtr<AVehicle> ASimulationLevelManager::ManuallyControlledVehicle
private

Vehicle that is currently in manual control of the player

Definition at line 114 of file SimulationLevelManager.h.

Referenced by CeaseManualControlOfVehicle(), and TakeManualControlOfVehicle().

◆ OnSimulationPhaseChanged

FSimulationPhaseChanged ASimulationLevelManager::OnSimulationPhaseChanged

Event triggered when simulation phase has been changed

Definition at line 55 of file SimulationLevelManager.h.

Referenced by SetSimulationPhase().

◆ OnSimulationStateChanged

FSimulationStateChanged ASimulationLevelManager::OnSimulationStateChanged

Event triggered when simulation state has been changed

Definition at line 49 of file SimulationLevelManager.h.

Referenced by SetSimulationState().

◆ SensorsManager

TObjectPtr<USensorsManagerComponent> ASimulationLevelManager::SensorsManager
protected

Definition at line 101 of file SimulationLevelManager.h.

Referenced by ASimulationLevelManager().

◆ SimulationPhase

ESimulationPhase ASimulationLevelManager::SimulationPhase
private

Current simulation phase

Definition at line 110 of file SimulationLevelManager.h.

Referenced by CeaseManualControlOfVehicle(), and SetSimulationPhase().

◆ SimulationState

ESimulationState ASimulationLevelManager::SimulationState
private

Current simulation state

Definition at line 107 of file SimulationLevelManager.h.

Referenced by SetSimulationState().

◆ TeleportLocations

TArray<FLevelTeleportLocation> ASimulationLevelManager::TeleportLocations

Definition at line 92 of file SimulationLevelManager.h.


The documentation for this class was generated from the following files: