Example #1
0
    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();
    }
Example #2
0
    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);
    }