Exemple #1
0
    public CustomizeItemClone GetClone(GameObject parent)
    {
        var index = SpawnedPrefabs.FindIndex(s => !s.gameObject.activeSelf);

        if (index != -1)
        {
            SpawnedPrefabs[index].gameObject.SetActive(true);
            return(SpawnedPrefabs[index]);
        }

        var clone = Instantiate(Prefab);

        clone.SetActive(true);

        var scripts = clone.gameObject.GetComponentsInChildren <CustomizeItemPrefab>();

        foreach (var script in scripts)
        {
            script.OnCreate(parent);
        }

        var item = new CustomizeItemClone()
        {
            gameObject = clone,
            parent     = this
        };

        return(item);
    }
Exemple #2
0
 public void SetSocketParent(GameObject socket, CustomizeItemClone clone)
 {
     clone.gameObject.transform.SetParent(socket.transform);
     clone.gameObject.transform.localPosition = socket.transform.localPosition;
     clone.gameObject.transform.localRotation = socket.transform.localRotation;
 }
Exemple #3
0
 public void ResetClose(CustomizeItemClone clone)
 {
     clone.gameObject.transform.SetParent(null);
     clone.gameObject.SetActive(false);
 }