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); }
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); }