コード例 #1
0
    private void AddNewContainer()
    {
        GameObject containerObj  = Resources.Load("Prefabs/EditorTileContainer") as GameObject;
        GameObject tileContainer = GameObject.Instantiate(containerObj);

        tileContainer.transform.SetParent(this.transform);
        tileContainer.transform.localPosition = this.PositionForNewContainer();
        EditorTileContainerBehavior tileContainerBehavior = tileContainer.GetComponent <EditorTileContainerBehavior>();

        tileContainerBehavior.owner = this;
        this.tileContainers.Add(tileContainerBehavior);
    }
コード例 #2
0
    public void DidPressDeleteButton(EditorTileContainerBehavior container)
    {
        this.tileContainers.Remove(container);
        for (int i = 0; i < this.tileContainers.Count; ++i)
        {
            this.tileContainers[i].transform.localPosition = this.PositionForContainer(i);
        }

        if (this.tileContainers.Count == 0)
        {
            this.AddNewContainer();
        }
    }