Example #1
0
        // Allows you to provide an action when the user clicks on the
        // other button.
        void SaveStartUpGroup()
        {
            experimentData.elements.Clear();
            GameObject    pfb;
            GameObject    item;
            RunTimeElemet element;

            for (int i = 0; i < objectsParent.childCount; i++)// (Transform item in objectsParent)
            {
                item = objectsParent.GetChild(i).gameObject;
                //pfb = PrefabUtility.GetPrefabObject(item) as GameObject;
                pfb = PrefabUtility.GetPrefabParent(item) as GameObject;
                if (pfb == null)
                {
                    EditorUtility.DisplayDialog("警告", item.name + "对象未制作预制体", "确认");
                    break;
                }
                element          = new RunTimeElemet();
                element.name     = pfb.name;
                element.element  = pfb;
                element.id       = i;
                element.position = item.transform.position;
                element.rotation = item.transform.rotation;
                experimentData.elements.Add(element);
            }
        }
Example #2
0
        // This is called when the user clicks on the Create button.
        void CreateNewGroup()
        {
            ConfigGroup group = new ConfigGroup(_title);

            configData.groupList.Add(group);

            GameObject    pfb;
            GameObject    item;
            RunTimeElemet element;

            for (int i = 0; i < objectsParent.childCount; i++)// (Transform item in objectsParent)
            {
                item = objectsParent.GetChild(i).gameObject;
                //pfb = PrefabUtility.GetPrefabObject(item) as GameObject;
                pfb = PrefabUtility.GetPrefabParent(item) as GameObject;
                if (pfb == null)
                {
                    EditorUtility.DisplayDialog("警告", item.name + "对象未制作预制体", "确认");
                    break;
                }
                element          = new RunTimeElemet();
                element.name     = pfb.name;
                element.element  = pfb;
                element.id       = i;
                element.position = item.transform.position;
                element.rotation = item.transform.rotation;
                group.elements.Add(element);
            }
            EditorUtility.SetDirty(configData);
        }
Example #3
0
        public void ReStart()
        {
            ResatToBeginState();

            GameObject item;
            IInOutItem inoutItem;

            for (int i = 0; i < elements.Count; i++)
            {
                RunTimeElemet element = elements[i];
                item = GameObject.Instantiate(element.element, element.position, element.rotation) as GameObject;
                item.transform.SetParent(group.transform);
                inoutItem = item.GetComponent <IInOutItem>();
                loadedItems.Add(item);

                if (element.startActive)
                {
                    startActive.Enqueue(inoutItem);
                }
            }
        }