public void ChangeState() { currentLight.color = (currentLight.color == Color.red) ? Color.green : Color.red; if (currentLight.color == Color.green) { trafficLightScript.ChangeGo(); } else { trafficLightScript.ChangeStop(); } }