private IEnumerator Ascend() { var rock = GameObject.FindWithTag("Rock"); var shadow = GameObject.FindWithTag("Shadow"); if (rock != null) { Destroy(rock.gameObject); } if (shadow != null) { shadow.SetActive(false); } Scroller.ScrollBackground(ChangeDirection); while (Scroller.IsBackgroundScrolling()) { yield return(null); } if (shadow != null) { shadow.SetActive(true); } if (GameObject.FindWithTag("Rock") == null) { GameController.Instance.SpawnRock(); } }
public IEnumerator StartAnimation() { GameObject instantiatedAnimatedPrestigeGameObject = Instantiate(AnimatedPrestige); ParticleSystem particleSystem = instantiatedAnimatedPrestigeGameObject.GetComponent <ParticleSystem>(); OreProbabilitesGameObject.SetActive(false); ShadowGameObject.SetActive(false); SliderGameObject.SetActive(false); PriceTagGameObject.SetActive(false); GameObject rock = GameObject.FindWithTag("Rock"); if (rock != null) { Destroy(rock); } AudioController.Instance.PlayAudioEffectInLoop(CrystalSound, CrystalSoundVolume); StartCoroutine(ChangeLevel()); while (!_isLevelChangeFinished) { if (!Scroller.IsBackgroundScrolling()) { Scroller.ScrollBackground(Direction.Up); } yield return(null); } particleSystem.Stop(); Destroy(instantiatedAnimatedPrestigeGameObject, particleSystem.main.duration); AudioController.Instance.StopAndDestroyLoopedAudioEffects(); OreProbabilitesGameObject.SetActive(true); ShadowGameObject.SetActive(true); SliderGameObject.SetActive(true); PriceTagGameObject.SetActive(true); GameController.Instance.SpawnRock(); }