Exemple #1
0
    private void Awake()
    {
        if (!ins)
        {
            ins = this;
        }

        boardTileScale       = GameScaler.GetBoardTileScale();
        scaledBlockTileScale = GameScaler.GetScaledBlockTileScale();

        CreateBoard();
    }
Exemple #2
0
    private void CreateBoard()
    {
        Vector3 scale = GameScaler.GetBoardTileScale();

        for (int y = 0; y < BOARD_SIZE; y++)
        {
            for (int x = 0; x < BOARD_SIZE; x++)
            {
                Transform t = Instantiate(boardTilePrefab, boardTransform).transform;
                t.position       = new Vector3(x, y, 0);
                t.localScale     = scale;
                boardTiles[x, y] = t.GetComponent <SpriteRenderer>();
            }
        }

        for (int i = 0; i < BLOCKS_AMOUNT; i++)
        {
            if (!PlayerPrefs.HasKey(i + "block"))
            {
                blocks[i] = SpawnBlock(i, Rand(0, BLOCK_PREFABS_AMOUNT));
            }
        }
    }