Exemple #1
0
 void Start()
 {
     placerScript   = placer.GetComponent <SpritePlacer>();
     serverScript   = GetComponent <ServerController>();
     attachedButton = GetComponent <Button>();
     attachedButton.onClick.AddListener(() => SaveTileMaps(tilemaps));
 }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        GameObject   newButton;
        SpritePlacer script = placerObject.GetComponent <SpritePlacer>();

        foreach (var tile in tiles)
        {
            Debug.Log(tile.name);
            newButton = (GameObject)Instantiate(prefabButton, transform);
            newButton.GetComponent <Image>().sprite = tile;


            UnityEngine.Events.UnityAction action1 = () => { script.SetSelectedTileBase(tile.name); };
            newButton.GetComponent <Button>().onClick.AddListener(action1);//find the button and set
        }
    }
Exemple #3
0
    void makeButtons()
    {
        GameObject   newButton;
        SpritePlacer script = placerObject.GetComponent <SpritePlacer>();

        //Remove all buttons currently in the content window
        foreach (Transform child in ContentWindow.transform)
        {
            Destroy(child.gameObject);
        }

        //Add new buttons
        foreach (var tile in tiles)
        {
            newButton = (GameObject)Instantiate(prefabButton, ContentWindow.transform);
            newButton.GetComponent <Image>().sprite = tile;


            UnityEngine.Events.UnityAction action1 = () => { script.SetSelectedTileBase(tile.name); };
            newButton.GetComponent <Button>().onClick.AddListener(action1);//find the button and set
        }
    }