Ejemplo n.º 1
0
        public void AddToggleProperty(string name, bool isStartProperty)
        {
            GameObject newProperty = GameObject.Instantiate(myController.togglePropertyPrefab);

            newProperty.transform.SetParent(propertyParent.transform);
            newProperty.GetComponent <STKTestControllerProperty>().text.text = name;
            if (isStartProperty)
            {
                startProperties = Array.ConvertAll(STKArrayTools.AddElement(newProperty.GetComponent <STKTestControllerProperty>(), startProperties), item => item as STKTestControllerProperty);
            }
            else
            {
                runningProperties = Array.ConvertAll(STKArrayTools.AddElement(newProperty.GetComponent <STKTestControllerProperty>(), runningProperties), item => item as STKTestControllerProperty);
            }
            startButton.transform.SetParent(transform.parent);
            startButton.transform.SetParent(propertyParent.transform); //Reset button to last position
        }
        public void AddStage()
        {
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            PrefabUtility.DisconnectPrefabInstance(gameObject);
            GameObject newStage = Instantiate(stagePrefab);

            newStage.transform.parent = verticalGroup.transform;
            newStage.GetComponent <STKTestStage>().myController = gameObject.GetComponent <STKTestController>();
            Selection.activeGameObject = newStage;
            testStages = Array.ConvertAll(STKArrayTools.AddElement(newStage, testStages), item => item as GameObject);
            testStages = Array.ConvertAll(STKArrayTools.ClearNullReferences(testStages), item => item as GameObject);
            foreach (GameObject g in testStages)
            {
                if (g != null)
                {
                    g.SetActive(false);
                }
            }
            testStages[testStages.Length - 1].SetActive(true);
            testStages[testStages.Length - 1].name = "Stage " + (testStages.Length - 1);
        }