9 #include "Kismet/GameplayStatics.h" 27 auto LightId = CarlaLight->GetId();
30 UE_LOG(LogCarla, Warning, TEXT(
"Light Id overlapping"));
42 Lights.Remove(CarlaLight->GetId());
61 std::vector<carla::rpc::LightState> result;
67 UCarlaLight* CarlaLight = Light.Value;
69 result.push_back(CarlaLight->GetLightState());
76 std::vector<carla::rpc::LightState> LightsToSet,
82 for(
auto& LightState : LightsToSet) {
83 UCarlaLight* CarlaLight =
Lights.FindRef(LightState._id);
85 CarlaLight->SetLightState(LightState);
108 TArray<AActor*> WeatherActors;
109 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AWeather::StaticClass(), WeatherActors);
110 if (WeatherActors.Num())
112 if (
AWeather* WeatherActor = Cast<AWeather>(WeatherActors[0]))
114 WeatherActor->SetDayNightCycle(active);
123 if(Client.Key != ClientThatUpdate)
UCarlaLight * GetLight(int Id)
bool IsUpdatePending() const
TMap< int, UCarlaLight *> Lights
void UnregisterLight(UCarlaLight *CarlaLight)
void SetDayNightCycle(const bool active)
void Deinitialize() override
void Initialize(FSubsystemCollectionBase &Collection) override
void SetClientStatesdirty(FString ClientThatUpdate)
void SetLights(FString Client, std::vector< carla::rpc::LightState > LightsToSet, bool DiscardClient=false)
TMap< int, UCarlaLight *> & GetLights()
void RegisterLight(UCarlaLight *CarlaLight)
TMap< FString, bool > ClientStates