예제 #1
0
    public void StartGame()
    {
        //  this.analyticsController.PushDesignEvent("cs:core:start_game");

        if (!debug)
        {
            curLevel       = PlayerPrefs.GetInt("LevelNumber");
            countPartToWin = levelBase.levels[curLevel].countPartToWin;
            goldCount      = PlayerPrefs.GetInt("GoldCount");

            Level newLevel = Instantiate(levelBase.levels[curLevel].prefab, new Vector3(0, 0, startPositionLevelPrefab), Quaternion.identity).GetComponent <Level>();
            newLevel.Initialization(playerController, countPartToWin);
            newLevel.ShowText();
            levelModel = newLevel;

            startPositionLevelPrefab += 42.7f;

            Level nextLevel = Instantiate(levelBase.levels[curLevel + 1].prefab, new Vector3(0, 0, 39.7f), Quaternion.identity).GetComponent <Level>();
            nextlevelModel = nextLevel;

            startPositionLevelPrefab += 42.7f;
        }
        else
        {
            countPartToWin = 15;
            levelModel     = FindObjectOfType <Level>();
            levelModel.Initialization(playerController, countPartToWin);
            levelModel.ShowText();
        }

        coloring.InitializationOneScheme(levelBase.levels[curLevel].colorScheme, levelModel.textStart, levelModel.textFinish);
        coloring.SetColorSchemeForce();

        loadingScreen.gameObject.SetActive(true);
        loadingScreen.HideLoadScreen();

        progressBar.SetCountEmptyCell(countPartToWin);
        progressBar.AddCell(0, countPartToWin);

        levelComplete.gameObject.SetActive(true);
        levelComplete.HideWindow();

        levelFailed.gameObject.SetActive(true);
        levelFailed.HideWindow();

        downPanel.gameObject.SetActive(true);
    }