void Update()
{
if (_root.state != GameState.PLAYING)
return;
GameObject firstSection = (GameObject) currentPath [0];
if(Camera.main.transform.position.z - 15 > firstSection.transform.position.z) {
currentPath.RemoveAt(0);
Destroy(firstSection);
if (levelDone)
return;
if(currentLength < gameLength) {
addNextSection();
} else {
addEndingSection();
levelDone = true;
}
}
}