void Setup() { if (setupDone) { return; } setupDone = true; I = this; //raysRT = Rays.GetComponent<RectTransform>(); showTween = DOTween.Sequence().SetAutoKill(false).Pause() .Append(this.GetComponent <Image>().DOFade(0, 0.35f).From().SetEase(Ease.Linear)) .Join(ContentRT.DOAnchorPosY(-960, 0.35f).From().SetEase(Ease.OutBack)) .OnRewind(() => { this.gameObject.SetActive(false); bgTween.Rewind(); }) .OnComplete(() => this.StartCoroutine(CO_ShowComplete())); for (int i = 0; i < Stars.Length; ++i) { EndgameStar star = Stars[i]; star.Setup(); showTween.Insert(0.2f + i * 0.1f, star.StarImg.DOFade(0, 0.3f).From().SetEase(Ease.Linear)); showTween.Insert(0.2f + i * 0.1f, star.transform.DORotate(new Vector3(0, 0, -200), 0.3f, RotateMode.FastBeyond360).From()); } bgTween = DOTween.Sequence().SetAutoKill(false).Pause() .Append(Rays.DOFade(0, 0.35f).From().SetEase(Ease.Linear)) .Join(Rays.transform.DORotate(new Vector3(0, 0, 360), 9f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(9999)); this.gameObject.SetActive(false); }
void OnDestroy() { if (I == this) { I = null; } showTween.Kill(); bgTween.Kill(); }