void Start() { FPSPlayerComponent = Camera.main.GetComponent <CameraControl>().playerObj.GetComponent <FPSPlayer>(); asource = gameObject.AddComponent <AudioSource>(); asource.spatialBlend = 0.0f; WaveText = FPSPlayerComponent.waveUiObj.GetComponent <WaveText>(); WaveTextShadow = FPSPlayerComponent.waveUiObjShadow.GetComponent <WaveText>(); //initialize health amounts on GUIText objects WaveText.waveGui = waveNumber; WaveTextShadow.waveGui = waveNumber; WaveText.waveGui2 = NpcsToSpawn - killedNpcs; WaveTextShadow.waveGui2 = NpcsToSpawn - killedNpcs; WarmupText = FPSPlayerComponent.warmupUiObj.GetComponent <WarmupText>(); WarmupTextShadow = FPSPlayerComponent.warmupUiObjShadow.GetComponent <WarmupText>(); tempColor = WarmupText.textColor; tempColor2 = WarmupTextShadow.textColor; WarmupText.warmupGui = countDown; WarmupTextShadow.warmupGui = countDown; WarmupUIText1 = WarmupText.GetComponent <Text>(); WarmupUIText2 = WarmupTextShadow.GetComponent <Text>(); warmupTextPos1Orig = WarmupUIText1.rectTransform.anchoredPosition; warmupTextPos2Orig = WarmupUIText2.rectTransform.anchoredPosition; StartCoroutine(StartWave()); }
void Start() { FPSPlayerComponent = Camera.main.GetComponent <CameraControl>().playerObj.GetComponent <FPSPlayer>(); asource = gameObject.AddComponent <AudioSource>(); asource.spatialBlend = 0.0f; //create instance of GUIText to display health amount on hud waveGuiObjInstance = Instantiate(waveGuiObj, Vector3.zero, transform.rotation) as GameObject; //set reference for main color element of heath GUIText WaveText = waveGuiObjInstance.GetComponent <WaveText>(); //set reference for shadow background color element of GUIText //this object is a child of the main GUIText object, so access it as an array WaveText2 = waveGuiObjInstance.GetComponentsInChildren <WaveText>(); //initialize health amounts on GUIText objects WaveText.waveGui = waveNumber; WaveText2[1].waveGui = waveNumber; WaveText.waveGui2 = NpcsToSpawn - killedNpcs; WaveText2[1].waveGui2 = NpcsToSpawn - killedNpcs; //create instance of GUIText to display health amount on hud warmupGuiObjInstance = Instantiate(warmupGuiObj, Vector3.zero, transform.rotation) as GameObject; //set reference for main color element of heath GUIText WarmupText = warmupGuiObjInstance.GetComponent <WarmupText>(); //set reference for shadow background color element of GUIText //this object is a child of the main GUIText object, so access it as an array WarmupText2 = warmupGuiObjInstance.GetComponentsInChildren <WarmupText>(); tempColor = WarmupText.textColor; tempColor2 = WarmupText2[1].textColor; WarmupText.warmupGui = countDown; WarmupText2[1].warmupGui = countDown; WarmupGUIText1 = WarmupText.GetComponent <GUIText>(); WarmupGUIText2 = WarmupText2[1].GetComponent <GUIText>(); StartCoroutine(StartWave()); }