1 using System;
2 using
UnityEngine;
3
4 namespace
UnityStandardAssets.Vehicles.Car
5 {
6     
public class BrakeLight : MonoBehaviour
7     {
8         
public CarController car; // reference to the car controller, must be dragged in inspector
9
10         
private Renderer m_Renderer;
11
12
13         
private void Start()
14         {
15             m_Renderer = GetComponent<Renderer>();
16         }
17
18
19         
private void Update()
20         {
21             
// enable the Renderer when the car is braking, disable it otherwise.
22             m_Renderer.enabled = car.BrakeInput >
0f;
23         }
24     }
25 }