// Use this for initialization
    void Start()
    {
        Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Сцена: " + SceneManager.GetActiveScene().name + " загружена.");

        SGH = FindObjectOfType <SingleGameHelper>();

        Speed = 0;
        TxtSpeedValue.text = Speed.ToString();
    }
Example #2
0
    Vector2 stoneLineSpawnPosition = new Vector2(0f, 0f);                     //Место спавна первой каменной линии (HardCore Mode)

    // Use this for initialization
    void Start()
    {
        Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Сцена: " + SceneManager.GetActiveScene().name + " загружена.");

        SGH   = FindObjectOfType <SingleGameHelper>();
        MBSGM = FindObjectOfType <MessageBoxSingleGameMenu>();
        MBGO  = FindObjectOfType <MessageBoxGameOver>();
        PP    = FindObjectOfType <PlayerProfile>();
        score = 0;

        TxtGameMode.text  = "Режим: " + SGH.GetGameMode().ToString();
        TxtGameSpeed.text = "Скорость: " + SGH.GetGameSpeed().ToString();

        Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Получена и выведена информация об настройках игры:"
                  + " Режим: " + SGH.GetGameMode().ToString() + " ;"
                  + " Скорость: " + SGH.GetGameSpeed().ToString());

        Vector2 vec = transform.position;

        playerPositionX = vec.x + stepSize;
        playerPositionY = vec.y + stepSize;

        tetrominoSpawnPosition        = new Vector2(playerPositionX + stepSize * 5, playerPositionY + stepSize * 22);
        tetrominoPreviewSpawnPosition = new Vector2(playerPositionX + stepSize * 15f, playerPositionY + stepSize * 16f);
        stoneLineSpawnPosition        = new Vector2(playerPositionX, playerPositionY);

        Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Заданы координаты спавна фигур:"
                  + " Координаты спавна активной фигуры: " + tetrominoSpawnPosition.ToString() + " ;"
                  + " Координаты спавна предпросмотра фигуры: " + tetrominoPreviewSpawnPosition.ToString());

        if (SGH != null)
        {
            gameSpeed = (11 - (double)SGH.GetGameSpeed()) / 10;
            GameMode  = SGH.GetGameMode();
        }
        else
        {
            gameSpeed = 1;
            GameMode  = SingleGameHelper.GameModeEnum.Classic;
        }

        SpawnNextTetromino();

        bestRecord = PlayerPrefs.GetInt(PlayerPreferencesHelper.GetBestRecordKey(GameMode, SGH.GetGameSpeed()), 0);

        youBestRecord = PlayerPrefs.GetInt(PlayerPreferencesHelper.GetPersonalBestRecordKey(PP.profileNum
                                                                                            , GameMode, SGH.GetGameSpeed()), 0);

        TxtBestRecord.text    = bestRecord.ToString();
        TxtYouBestRecord.text = youBestRecord.ToString();

        Debug.Log(DateTime.Now.ToString("hh:mm:ss:ffff") + ": Получены и выведена информация об рекордах:"
                  + " Общий рекорд: " + TxtYouBestRecord.text + " ;"
                  + " Личный рекорд для " + PP.profileNum + "профиля: " + TxtBestRecord.text);
    }