private void Awake() { App.I.Initialize(); closeButton.onClick.AddListener(OnCloseButtonClicked); toBeContinue.SetActive(ProgressHelper.I.GetComplete()); if (toBeContinue.activeInHierarchy) { sceneMask.Init(); } else { sceneMask.Init(Color.black); } }
private void Awake() { App.I.Initialize(); ProgressHelper.I.Initialize(stagePrefabs.Count); sceneMask.Init(Color.black); var currentStage = ProgressHelper.I.GetStage(); Debug.Log($"currentStage: {currentStage}"); StartCoroutine(DisplayStageId()); LoadStage(); LoadDashboard(); RegisterEvent(); }
private void Start() { EventEmitter.Emit(GameEvent.PlayMusic, new MusicEvent(MusicType.Mute)); if (!ProgressHelper.I.GetSawStory()) { sceneMask.Init(); ProgressHelper.I.SetSawStory(true); StartCoroutine(ShowStory()); } else { sceneMask.Init(); StartCoroutine(ShowTitle()); } IEnumerator ShowMask(Color maskColor, float duration = 1f) { var color = maskColor; mask.color = new Color(color.r, color.g, color.b, 0); mask.gameObject.SetActive(true); DOTween.ToAlpha(() => mask.color, (c) => mask.color = c, 1, duration); yield return(new WaitForSeconds(duration)); } IEnumerator HideMask(float duration = 1f) { var color = mask.color; mask.color = new Color(color.r, color.g, color.b, 1); DOTween.ToAlpha(() => mask.color, (c) => mask.color = c, 0, duration); yield return(new WaitForSeconds(duration)); mask.gameObject.SetActive(false); } IEnumerator ShowTitle() { yield return(HideMask()); OnTitleShow(); } IEnumerator ShowStory() { EventEmitter.Emit(GameEvent.PlayMusic, new MusicEvent(MusicType.Story_BGM)); storyRoot.SetActive(true); foreach (var story in stories) { story.gameObject.SetActive(true); yield return(HideMask()); if (story == stories.Last()) { yield return(new WaitForSeconds(1f)); EventEmitter.Emit(GameEvent.PlaySound, new SoundEvent(SoundType.Car_Hit, 3)); yield return(new WaitForSeconds(1f)); skipButton.gameObject.SetActive(false); yield return(ShowMask(Color.white, 3f)); story.gameObject.SetActive(false); } else { yield return(new WaitForSeconds(2f)); yield return(ShowMask(Color.black)); story.gameObject.SetActive(false); } } EventEmitter.Emit(GameEvent.PlayMusic, new MusicEvent(MusicType.Mute)); yield return(HideMask()); storyRoot.SetActive(false); OnTitleShow(); } }