Skip to content

Commit 8408a68

Browse files
authored
Merge pull request #263 from tier4/feature/improve-pedestrian-light
Added LightOn Shader Properties to Traffic Light
2 parents bd14119 + 6973645 commit 8408a68

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Assets/AWSIM/Scripts/Environments/TrafficLight.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public class EmissionConfig
105105
const string EmissiveColor = "_EmissiveColor";
106106
const string EmissiveIntensity = "_EmissiveIntensity";
107107
const string EmissiveExposureWeight = "_EmissiveExposureWeight";
108+
const string LightOnFlag = "_LightOn";
108109
const float flashIntervalSec = 0.5f; // flash bulb lighting interval(sec).
109110

110111
float timer = 0; // used for flashing status. NOTE: Might as well make it static and refer to the same time.
@@ -210,13 +211,21 @@ void Set(bool isLightOn)
210211
var config = bulbColorConfigPairs[color];
211212
material.SetColor(EmissiveColor, config.Color * config.Intensity);
212213
material.SetFloat(EmissiveExposureWeight, config.ExposureWeight);
214+
if(material.HasProperty(LightOnFlag))
215+
{
216+
material.SetInt(LightOnFlag, 1);
217+
}
213218
this.isLightOn = true;
214219
timer = 0;
215220
}
216221
else
217222
{
218223
material.SetColor(EmissiveColor, defaultEmissiveColor);
219224
material.SetFloat(EmissiveExposureWeight, defaultEmissiveExposureWeight);
225+
if(material.HasProperty(LightOnFlag))
226+
{
227+
material.SetInt(LightOnFlag, 0);
228+
}
220229
this.isLightOn = false;
221230
timer = 0;
222231
}

0 commit comments

Comments
 (0)