Example #1
0
    public void Setup(GameData data)
    {
        _data = data;

        _level = new LevelManager();

        _board = new BoardModel(Constants.WIDTH, Constants.HEIGHT);

        _activeBricks = new ActiveBricks();

        _UI = GameObject.FindObjectOfType <GameUI>();
        _UI.Setup(this);

        _display = _UI.brickDisplay;
        _display.Setup(_data.GetTileSet(_level.Level));

        _randomizer = new Randomizer(_data);
        _input      = new InputManager(this);

        _score       = 0;
        _rowsCleared = 0;

        NewShape();

        _display.UpdateDisplay(_board, _activeBricks);
    }
Example #2
0
    public void UpdateDisplay(TileSet tileSet)
    {
        if (_display == null)
        {
            _display = this.GetComponent <BrickDisplay>();
            _display.Setup(tileSet);
        }

        if (_display != null && Shape != null)
        {
            _display.SetTileSet(tileSet);
            BoardModel board = new BoardModel(Shape.Size, Shape.Size);
            Shape.ApplyToBoard(board, 0);
            _display.UpdateDisplay(board);
        }
    }