void OnDestroy() { if (I == this) { I = null; } this.StopAllCoroutines(); showTween.Kill(); godraysTween.Kill(); minigamesStarsToBarTween.Kill(); }
void Setup() { if (setupDone) { return; } setupDone = true; I = this; showTween = DOTween.Sequence().SetAutoKill(false).Pause() .Append(this.GetComponent <Image>().DOFade(0, 0.35f).From().SetEase(Ease.Linear)) .Join(GodraysCanvas.DOFade(0, 0.35f).From().SetEase(Ease.Linear)) .OnRewind(() => { this.gameObject.SetActive(false); godraysTween.Pause(); }); godraysTween = DOTween.Sequence().SetAutoKill(false).Pause().SetLoops(-1, LoopType.Restart) .Append(Godray0.DORotate(new Vector3(0, 0, 360), Godrays360Duration, RotateMode.FastBeyond360).SetRelative().SetEase(Ease.Linear)) .Join(Godray1.DORotate(new Vector3(0, 0, -360), Godrays360Duration, RotateMode.FastBeyond360).SetRelative().SetEase(Ease.Linear)); this.gameObject.SetActive(false); }