Пример #1
0
    IEnumerator GameOverEnumerator(Vector2 cameraPos, float[] damageTaken, bool isQuit)
    {
        if (!isQuit)
        {
            Time.timeScale = 0.25f;
            for (float i = 0; i < (float)3 / 4; i += Time.deltaTime)
            {
                if (oneMoreChance)
                {
                    break;
                }
                yield return(null);
            }
        }
        if (oneMoreChance)
        {
            oneMoreChance = false;
        }
        else
        {
            Time.timeScale = 1;
            cameraCont.GameOver();
            starReward = (int)killSum / 5 + (int)currentGameTime / 6;
            gameOver   = true;
            challengeCont.GameOver(isQuit);
            StartCoroutine(spawnCont.GameOver(isQuit));
            healthAbilityOn = false;
            int recordValue = (data.highScoreTime < currentGameTime ? 1 : 0) + (data.highScoreKill < killSum ? 2 : 0);
            dataCont.SetData((int)currentGameTime, killSum, currentEnemiesKilled, damageTaken, recordValue);
            SaveCurrentGameData(damageTaken, isQuit);
            yield return(new WaitForSeconds(0.5f)); //TO avoid lag

            SaveAndLoad.SaveData(data);
        }
    }