// Use this for initialization void Start() { oldSpeed = speed = Random.Range(minSpeed, maxSpeed); trafficlight = GameObject.Find("trafficlight"); tlai = trafficlight.GetComponent <TrafficLightAI>(); }
// Start is called before the first frame update void Start() { rbCurrent = GetComponent <Rigidbody>(); rbCurrent.velocity = new Vector3(Random.Range(speed - 4f, speed), 0, 0); trafficLineHolder = GameObject.FindGameObjectWithTag("TrafficLightHolder"); trafficLightAI = trafficLineHolder.GetComponent <TrafficLightAI>(); col = trafficLightAI.materialXPlus.color; //meanXText = GameObject.FindGameObjectWithTag("MeanX").GetComponent<Text>(); }