示例#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);
    }
示例#2
0
    public void UpdateDisplay(BoardModel board, ActiveBricks bricks, TileSet tileSet)
    {
        int color = board.GetTile(_x, _y);

        if (color == 0 && bricks != null)
        {
            color = bricks.GetBrickAt(_x, _y);
        }

        if (_renderer == null)
        {
            _renderer = this.GetComponentInChildren <Renderer>();
        }

        if (color > 0)
        {
            _renderer.enabled  = true;
            _renderer.material = tileSet.TileMaterials[color - 1];
        }
        else
        {
            _renderer.enabled = false;
        }
    }
示例#3
0
 public void UpdateDisplay(BoardModel board, ActiveBricks activeBricks = null)
 {
     _bricks.ForEach((Brick b) => {
         b.UpdateDisplay(board, activeBricks, _tileSet);
     });
 }