private void FillTileChooser() { //Add event handler for tile newTiletype chosen, add all tiles to be available for choosing tileChooser.tileChosenEvent.AddListener(HandleTileChosen); foreach (SO_Tile tileInfo in gameSettings.allTileTypes) { TileToChoose ttcScript = tileChooser.AddTileToChoose(tileInfo); } tileChooser.AdjustContent(); }
public TileToChoose AddTileToChoose(SO_Tile tileInfo) { GameObject tileToChoose = Instantiate(tileToChoosePrefab, content.transform); RectTransform rt = tileToChoose.GetComponent <RectTransform>(); rt.anchoredPosition = new Vector3(-160, -80 - 120 * numberOfItems); TileToChoose tileToChooseScript = tileToChoose.GetComponent <TileToChoose>(); tileToChooseScript.SetTileInfo(tileInfo); tileToChooseScript.SetTileChooser(this); numberOfItems++; return(tileToChooseScript); }