void OnDestroy() { if (I == this) { I = null; } this.StopAllCoroutines(); showTween.Kill(); bgColorTween.Kill(); textTween.Kill(); }
/// <summary> /// Immediately clears the GlobalUI elements /// </summary> /// <param name="includeSceneTransitioner">If TRUE (default) also clears the sceneTransitioner, otherwise not</param> public static void Clear(bool includeSceneTransitioner = true) { if (includeSceneTransitioner && SceneTransitioner != null) { SceneTransitioner.CloseImmediate(); } if (ContinueScreen != null) { ContinueScreen.Close(true); } if (WidgetPopupWindow != null) { WidgetPopupWindow.Close(true); } if (WidgetSubtitles != null) { WidgetSubtitles.Close(true); } }
void Awake() { I = this; WalkieTalkie.gameObject.SetActive(true); WalkieTalkie.Setup(); showTween = DOTween.Sequence().SetUpdate(true).SetAutoKill(false).Pause() .Append(this.GetComponent <RectTransform>().DOAnchorPosY(170, 0.3f).From().SetEase(Ease.OutBack)) .OnPlay(() => this.gameObject.SetActive(true)) .OnRewind(() => { TextUI.text = ""; TextUItranslation.text = ""; this.gameObject.SetActive(false); }); bgColorTween = Background.GetComponent <Image>().DOColor(BgNoKeeperColor, 0.3f).SetEase(Ease.Linear) .SetAutoKill(false).Pause(); clearAndHide(); }