void Awake() { testStages = Array.ConvertAll(STKArrayTools.ClearNullReferences(testStages), item => item as GameObject); numberOfStages = testStages.Length; foreach (GameObject g in testStages) { g.SetActive(false); } testStages[0].SetActive(true); }
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 }
private void Start() { started = false; startProperties = Array.ConvertAll(STKArrayTools.ClearNullReferences(startProperties), item => item as STKTestControllerProperty); runningProperties = Array.ConvertAll(STKArrayTools.ClearNullReferences(runningProperties), item => item as STKTestControllerProperty); foreach (STKTestControllerProperty p in runningProperties) { p.gameObject.SetActive(false); } if (myController.testStages[0] == gameObject) { startButton.GetComponent <Button>().GetComponentInChildren <Text>().text = "Start Test"; } else { startButton.GetComponent <Button>().GetComponentInChildren <Text>().text = "Start Stage"; } }
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); }