Example #1
0
    GameObject InstantiateNumberedTile()
    {
        GameObject     tile       = GameObject.Instantiate(numberedTilePrefab);
        NumberTileView numberTile = tile.GetComponent <NumberTileView>();

        numberTile.UpdateHandler = this;

        return(tile);
    }
Example #2
0
    public void ApplyStyle(NumberTileView tile)
    {
        if (styles == null)
        {
            Initialize();
            Debug.Log("Style Initialized");
        }

        TileStyle style = defaultStyle;

        if (!styles.TryGetValue(tile.number, out style))
        {
            style = defaultStyle;
        }

        ApplyTileStyle(style, tile);
    }
Example #3
0
 private void ApplyTileStyle(TileStyle style, NumberTileView tile)
 {
     tile.SetBackground(background);
     tile.SetBackgroundColor(style.tileColor);
     tile.SetTextColor(style.textColor);
 }
Example #4
0
 public void OnNumberUpdated(NumberTileView numberTile)
 {
     this.style.ApplyStyle(numberTile);
 }
Example #5
0
 public NumberTile(GameGrid grid, CellPosition position)
 {
     this.grid      = grid;
     cell           = grid.GetCell(position);
     numberTileView = cell.GetChild().GetComponent <NumberTileView>();
 }
Example #6
0
 void CopyTileProperties(NumberTile tile)
 {
     this.cell = tile.cell;
     tile.numberTileView.Number = this.numberTileView.Number;
     this.numberTileView        = tile.numberTileView;
 }