void Start() { fader = GameObject.FindGameObjectWithTag("Player").GetComponent <FadeOutScene>(); currentDestination = DestinationParent.transform.GetChild(destIndex); popUpText = gameObject.GetComponent <Text>(); currentDestination.transform.Find("Cylinder").gameObject.SetActive(true); start = DateTime.Now; currentDestination = DestinationParent.transform.GetChild(destIndex); popUpText.text = "Find the " + currentDestination.name; background = popUpText.transform.parent.GetChild(0).gameObject; changing = true; }
void Update() { if (fader == null) { fader = GameObject.FindGameObjectWithTag("Player").GetComponent <FadeOutScene>(); } if (background) { background = popUpText.transform.parent.GetChild(0).gameObject; } if (changing) { if (!(DateTime.Now.Subtract(start).TotalSeconds > infoDelay)) { return; } currentDestination = DestinationParent.transform.GetChild(destIndex); popUpText.text = "Find the " + currentDestination.name; gameObject.GetComponent <Text>().text = "Find the " + currentDestination.name; currentDestination.transform.Find("Cylinder").gameObject.SetActive(true); changing = false; background.SetActive(true); } else { if (fader.isFadedOut()) { SceneManager.LoadScene("Launcher"); } if (currentDestination.transform.Find("Cylinder").gameObject.activeSelf) { return; } destIndex++; if (destIndex < DestinationParent.transform.childCount) { changing = true; start = DateTime.Now; } else { fadingOut = true; } } }
// Use this for initialization void Start() { _maxSecs = MaxDuration * 60; _start = DateTime.Now; int nChildren = DestinationParent.transform.childCount; _destinations = new ReachDestination[nChildren]; for (int i = 0; i < nChildren; i++) { ReachDestination destination = DestinationParent.transform.GetChild(i).GetComponentInChildren <ReachDestination>(); _destinations[i] = destination; } var index = 0; foreach (var destination in _destinations) { GameObject uiDestination = Instantiate(Resources.Load("Prefabs/UI_Destination")) as GameObject; uiDestination.transform.SetParent(this.transform); uiDestination.name = destination.getDestinationName(); uiDestination.GetComponentInChildren <Text>().text = destination.getDestinationName(); destination.SetIndex(index); destination.SetDestinationList(this.gameObject.GetComponent <CrossOfElement>()); index++; } _strokes = this.gameObject.GetComponentsInChildren <Image>().Where(go => go.gameObject != this.gameObject).ToArray(); foreach (var stroke in _strokes) { stroke.enabled = false; } var launchManager = GameObject.FindGameObjectWithTag("LaunchManager").GetComponent <LaunchManager>(); _fpc = launchManager.FirstPersonController; _fader = _fpc.GetComponent <FadeOutScene>(); }