// Update is called once per frame void Update() { switch (State) { case GameStates.NotRunning: return; case GameStates.Paused: return; case GameStates.DemoStarting: { //whatever is there is cleared to the bottom rapidly //and replaced with the start of the demo UpdateScrolling(); if (DemoLinesCleared == TilesY) { CurrentScrollSpeed = DemoScrollSpeed; State = GameStates.DemoRunning; } break; } case GameStates.DemoRunning: { //similar to normal running, with no lives, timers, or collisions UpdateScrolling(); break; } case GameStates.DemoEnding: { //demo is cleared to bottom rapidly, and replaced with //first screen of new game UpdateScrolling(); if (RowCounter > TilesY) { State = GameStates.WaitingForThumb; CurrentScrollSpeed = MinScrollSpeed; } break; } case GameStates.WaitingForThumb: { if (UI.AnimatingPanel()) { return; } CheckForThumbDown(); break; } case GameStates.CountDown: { CheckCountDown(); break; } case GameStates.ThumbActive: { if (UI.AnimatingPanel()) { return; } UpdateScrolling(); CheckForCollision(); AddEnemies(); UpdateEnemies(); if (CurrentLives == 0) { EndGame(); } if (ThumbUpTimer < 3) { ThumbUpTimer += Time.deltaTime; if (ThumbUpTimer > 3) { ThumbUpTimer = 3; } UI.UpdateTimer(ThumbUpTimer); } break; } case GameStates.ThumbLifted: { if (UI.AnimatingPanel()) { return; } UpdateScrolling(); AddEnemies(); UpdateEnemies(); ThumbUpTimer -= Time.deltaTime; if (ThumbUpTimer <= 0) { EndGame(); } UI.UpdateTimer(ThumbUpTimer); CheckForThumbDown(); break; } } }