/// <summary> /// Create a new tile of the specified element at position y, x /// </summary> private static void CreateTile(int y, int x, int element, Transform parent, bool fill = false) { GameObject go = Instantiate(_tilePrefabs[element], parent); go.name = "T " + x + " " + y; Transform t = go.transform; t.localPosition = new Vector2( InitPos + x, InitPos + y + (fill ? DropHeight : 0)); t.GetChild(0).localPosition = Z.VSelectedTileOverlay; t.GetChild(1).localPosition = Z.VTileSprite; Tile tile = go.AddComponent <Tile>(); tile.Initialize(go, y, x, (Element)element); _tiles[y, x] = tile; if (fill) { // Set the alpha to 0 to prevent spawn flicker tile.SpriteTransform.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); Animate.Fill(tile); } }