Research Article

Implementation and Evaluation of a Traffic Light Assistance System Based on V2I Communication in a Simulation Framework

Algorithm 2

Green light algorithm.
//-- Mode 0:
false, // direction 1 red
false, // direction 1 yellow
true, // direction 1 green
// Mode 0: Direction 1: Green
//
if (traffic_lights_mode == 0)
direction_time = 50; //
traffic_lights_counter += Time.deltaTime
2.0f;
if (traffic_lights_counter >= 2.0f
direction_time)
traffic_lights_mode = 1;
traffic_lights_counter = 0.0f;
//-- set direction 1 light green
if (traffic_lights_status_table
traffic_lights_mode 3) + 2 +
((int)(crossway_direction) 3 == true)
traffic_light_renderer.transform
.GetComponent
<Renderer>().materials . color =
new Color (1.0f, 1.0f, 1.0f, 1.0f);
if (use_real_lights == true)
lightsource_green1.
GetComponent<Light>()
.enabled = true;
if (traffic_light_type_single
== false)
lightsource_green2.
GetComponent<Light>()
.enabled = true;