Пример #1
0
        void GenerateLevel(int stage)
        {
            int maxFileCount  = Mathf.Min(stage / 3 + 1, 7);
            int fileCount     = Random.Range(Mathf.Max(3, maxFileCount - 2), maxFileCount);
            int width         = Mathf.Min(12 + stage / 2, 30);
            int maxFileLength = Mathf.Min(width * 3 - 1, Mathf.Max(stage * 8, 12));
            int storageSpace  = width * 6 + stage * 17;

            storageSpace = Mathf.FloorToInt(Random.Range(storageSpace, storageSpace * 1.4f));
            storageSpace = Mathf.Min(27 * width - 1, storageSpace);
            float precentageOfDyingSpace = Random.Range(0.7f, Mathf.Min(0.7f + stage * 0.06f, 0.95f));

            state = LevelControllerState.Running;
            float timePerDie = Mathf.Max(0.4f, (3.5f - Mathf.Log(stage) * 1.2f));

            maxFileLength = Mathf.Min(maxFileLength, (storageSpace - 1 * width) / fileCount);

            Debug.Log($"stage: {stage} width: {width}, storageSpace: {storageSpace}, fileCount: {fileCount}, maxFileLength: {maxFileLength}, timePerTile: {timePerDie}");
            level = new Level(width, storageSpace, fileCount, maxFileLength, precentageOfDyingSpace, timePerDie);

            GenerateColors(level.files.Count);
            GenerateSegmentObjects();
            GenerateDeadStorageIndicators();
            AdjustLevelBoundaries();
            GenerateFileStatusObjects();
            GameController.Instance.DebugOutput($"Segments: {level.segments.Count()}\nFiles: {level.files.Count}");
            UpdateScoreAndStage();
        }
Пример #2
0
 void HandleGameOver()
 {
     state = LevelControllerState.GameOver;
     UpdateScoreAndStage();
     gameOver.SetActive(true);
 }