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); }
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; } }
public void UpdateDisplay(BoardModel board, ActiveBricks activeBricks = null) { _bricks.ForEach((Brick b) => { b.UpdateDisplay(board, activeBricks, _tileSet); }); }