IEnumerator BoxInstantiate(int _startNum, TextChanger _tc) { ChoiseController cc; yield return(new WaitForSeconds(voiceDelayTime + 0.5f)); if (_startNum == 1) { choiseBoxes[0] = Instantiate(choiseBoxPrefab); choiseBoxes[0].transform.parent = canvas.transform; choiseBoxes[0].transform.localPosition = choiseBoxInitPosCenter; _tc = choiseBoxes[0].GetComponent <TextChanger>(); _tc.ChangeIcon(ctd.GetSprite(0)); _tc.ChangeText(""); cc = choiseBoxes[0].GetComponent <ChoiseController>(); cc.Init(0, this); } for (int i = _startNum; i < ctd.GetReplyCount(); ++i) { choiseBoxes[i] = Instantiate(choiseBoxPrefab); choiseBoxes[i].transform.parent = canvas.transform; choiseBoxes[i].transform.localPosition = choiseBoxInitPosSide[i - _startNum]; _tc = choiseBoxes[i].GetComponent <TextChanger>(); _tc.ChangeIcon(ctd.GetSprite(i)); _tc.ChangeText(""); cc = choiseBoxes[i].GetComponent <ChoiseController>(); cc.Init(i, this); } }
private IEnumerator StartInitialDelay() { TextChanger textChanger = textObject.GetComponent <TextChanger>(); textChanger.ChangeText("Ready?"); delaying = true; yield return(new WaitForSeconds(initialDelay)); textChanger.ChangeText("GO!"); yield return(new WaitForSeconds(.5f)); textChanger.ChangeText(""); delaying = false; }
private IEnumerator End() { TextChanger textChanger = textObject.GetComponent <TextChanger>(); textChanger.ChangeText("Time!"); yield return(new WaitForSeconds(4f)); SceneChanger s = GetComponent <SceneChanger>(); s.ChangeScene(); }
private void Update() { if (!delaying) { if (!coolingDown && !end) { StartCoroutine(SpawnCooldown()); } if (activeLength <= 0) { end = true; timer.ChangeText("0.00"); StartCoroutine(End()); } else { activeLength -= Time.deltaTime; string strLen = activeLength.ToString("#0.00"); timer.ChangeText(strLen); } } }
// Use this for initialization void Start() { Debug.Log("help"); xmlreader.ReadXML(file, path, node, id); Debug.Log(xmlreader.ReadXML(file, path, node, id)); string[] playerPosibilities = xmlreader.ReadSubnodes(file, path, id); for (int i = 0; i < xmlreader.ReadSubnodes(file, path + "/Greetings", id).Length; i++) { var choiceButton = (GameObject)Instantiate(button, new Vector3(0, 100 + (50 * i), 0), Quaternion.identity); choiceButton.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false); TextChanger textChanger = choiceButton.GetComponent <TextChanger>(); textChanger.ChangeText(xmlreader.ReadSubnodes(file, path + "/Greetings", id)[i]); Debug.Log(xmlreader.ReadSubnodes(file, path + "/Greetings", id)[i]); } }
private void Start() { timer = timerObject.GetComponent <TextChanger>(); timer.ChangeText(activeLength.ToString() + ".00"); StartCoroutine(StartInitialDelay()); }