fix weather
This commit is contained in:
parent
c20cb80b8d
commit
57d785bd7c
|
@ -36,17 +36,11 @@ void AWeather::CheckWeatherPostProcessEffects()
|
|||
else
|
||||
ActiveBlendables.Remove(DustStormPostProcessMaterial);
|
||||
|
||||
for (int32 i = 0; i < Sensors.Num(); i++)
|
||||
TArray<AActor*> SensorActors;
|
||||
UGameplayStatics::GetAllActorsOfClass(GetWorld(), ASceneCaptureCamera::StaticClass(), SensorActors);
|
||||
for (AActor* SensorActor : SensorActors)
|
||||
{
|
||||
auto& Sensor = Sensors[i];
|
||||
|
||||
if (!IsValid(Sensor))
|
||||
{
|
||||
Sensors.RemoveAtSwap(i);
|
||||
if (i == Sensors.Num())
|
||||
break;
|
||||
}
|
||||
|
||||
ASceneCaptureCamera* Sensor = Cast<ASceneCaptureCamera>(SensorActor);
|
||||
for (auto& ActiveBlendable : ActiveBlendables)
|
||||
Sensor->GetCaptureComponent2D()->PostProcessSettings.AddBlendable(ActiveBlendable.Key, ActiveBlendable.Value);
|
||||
}
|
||||
|
@ -81,10 +75,6 @@ void AWeather::ApplyWeather(const FWeatherParameters& InWeather)
|
|||
|
||||
void AWeather::NotifyWeather(ASensor* Sensor)
|
||||
{
|
||||
auto AsSceneCaptureCamera = Cast<ASceneCaptureCamera>(Sensor);
|
||||
if (AsSceneCaptureCamera != nullptr)
|
||||
Sensors.Add(AsSceneCaptureCamera);
|
||||
|
||||
CheckWeatherPostProcessEffects();
|
||||
|
||||
// Call the blueprint that actually changes the weather.
|
||||
|
|
|
@ -69,9 +69,6 @@ private:
|
|||
|
||||
TMap<UMaterial*, float> ActiveBlendables;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
TArray<ASceneCaptureCamera*> Sensors;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Weather")
|
||||
bool DayNightCycle = true;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue