Example #1
0
    public GameObject createPrefab(Transform parent = null)
    {
        Transform go = Instantiate(prefab);
        PlayerHandLayoutController phlc = parent.GetComponent <PlayerHandLayoutController>();

        if (phlc != null)
        {
            phlc.addItem(go.gameObject);
        }
        else
        {
            go.SetParent(parent);
        }
        return(go.gameObject);
    }
Example #2
0
    public GameObject createPrefab(Transform parent = null)
    {
        GameObject go = MonoBehaviour.Instantiate(prefab).gameObject;
        PlayerHandLayoutController phlc = parent.GetComponent <PlayerHandLayoutController>();

        if (phlc != null)
        {
            phlc.addItem(go);
        }
        else
        {
            go.transform.SetParent(parent);
        }
        go.GetComponent <CardObject>().card = this;
        return(go);
    }