private IEnumerator GoToInfo() { gameState = GameState.Info; SetMainMenuEnable(false); ParallelTasks MainMenuDisappearTask = GetMainMenuDisappearTask(CreditButton); while (!MainMenuDisappearTask.IsFinished) { MainMenuDisappearTask.Update(); yield return(null); } ParallelTasks InfoAppearTask = new ParallelTasks(); InfoAppearTask.Add(Utility.GetTextAppearTask(InfoText, ButtonAppearTime)); InfoAppearTask.Add(BackButton.GetComponent <GameButton>().GetAppearTask()); while (!InfoAppearTask.IsFinished) { InfoAppearTask.Update(); yield return(null); } BackButton.GetComponent <BoxCollider2D>().enabled = true; }
private IEnumerator GoToSetting() { gameState = GameState.Setting; SetMainMenuEnable(false); SettingMatchConfig(); ParallelTasks MainMenuDisappearTask = GetMainMenuDisappearTask(SettingButton); while (!MainMenuDisappearTask.IsFinished) { MainMenuDisappearTask.Update(); yield return(null); } ParallelTasks SettingAppearTask = new ParallelTasks(); SettingAppearTask.Add(BackButton.GetComponent <GameButton>().GetAppearTask()); SettingAppearTask.Add(Utility.GetTextAppearTask(MusicText, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetTextAppearTask(SoundEffectText, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetTextAppearTask(VibrationText, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(MusicMeter, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(MusicMeterCursor, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(SoundEffectMeter, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(SoundEffectMeterCursor, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(VibrationCheckBox, ButtonAppearTime)); SettingAppearTask.Add(Utility.GetImageAppearTask(VibrationCheckMark, ButtonAppearTime)); while (!SettingAppearTask.IsFinished) { SettingAppearTask.Update(); yield return(null); } BackButton.GetComponent <BoxCollider2D>().enabled = true; MusicMeterCursor.GetComponent <CircleCollider2D>().enabled = true; SoundEffectMeterCursor.GetComponent <CircleCollider2D>().enabled = true; VibrationCheckBox.GetComponent <BoxCollider2D>().enabled = true; }
private IEnumerator GoToSelectedLevel() { gameState = GameState.SelectLevelMenu; SetMainMenuEnable(false); SetLevelButtonColor(); ParallelTasks MainMenuDisappearTask = GetMainMenuDisappearTask(SelectLevelButton); while (!MainMenuDisappearTask.IsFinished) { MainMenuDisappearTask.Update(); yield return(null); } ParallelTasks SelectLevelAppearTasks = new ParallelTasks(); foreach (Transform child in AllLevelButtons.transform) { SelectLevelAppearTasks.Add(child.GetComponent <GameButton>().GetAppearTask()); } foreach (Transform child in LevelSelectionArrows.transform) { SelectLevelAppearTasks.Add(child.GetComponent <GameButton>().GetAppearTask()); } SelectLevelAppearTasks.Add(BackButton.GetComponent <GameButton>().GetAppearTask()); while (!SelectLevelAppearTasks.IsFinished) { SelectLevelAppearTasks.Update(); yield return(null); } SetSelectLevelEnable(true); BackButton.GetComponent <BoxCollider2D>().enabled = true; }
private IEnumerator LoadLevel(int index, LoadLevelType Type, GameObject LevelButton = null) { switch (Type) { case LoadLevelType.FromMainMenu: SetMainMenuEnable(false); ParallelTasks MainMenuDisappearTask = GetMainMenuDisappearTask(PlayButton); while (!MainMenuDisappearTask.IsFinished) { MainMenuDisappearTask.Update(); yield return(null); } break; case LoadLevelType.FromSelectionMenu: BackButton.GetComponent <BoxCollider2D>().enabled = false; SetSelectLevelEnable(false); ParallelTasks LevelButtonDisappearTasks = new ParallelTasks(); foreach (Transform child in AllLevelButtons.transform) { if (child.gameObject == LevelButton) { LevelButtonDisappearTasks.Add(child.GetComponent <GameButton>().GetSelectedDisappearTask()); } else { LevelButtonDisappearTasks.Add(child.GetComponent <GameButton>().GetUnselectedDisappearTask()); } } foreach (Transform child in LevelSelectionArrows.transform) { LevelButtonDisappearTasks.Add(child.GetComponent <GameButton>().GetUnselectedDisappearTask()); } LevelButtonDisappearTasks.Add(BackButton.GetComponent <GameButton>().GetUnselectedDisappearTask()); while (!LevelButtonDisappearTasks.IsFinished) { LevelButtonDisappearTasks.Update(); yield return(null); } break; case LoadLevelType.LevelFinish: BackButton.GetComponent <BoxCollider2D>().enabled = false; levelState = LevelState.Clear; SerialTasks LevelEndTasks = new SerialTasks(); LevelEndTasks.Add(GetLevelEndUITask(false)); LevelEndTasks.Add(new WaitTask(PerformLevelFinishEffectWaitTime)); LevelEndTasks.Add(GetBubblePowerUpTasks()); LevelEndTasks.Add(GetShockWaveEmitAndFadeTasks()); LevelEndTasks.Add(GetBubbleMoveOutPrepareTasks()); while (!LevelEndTasks.IsFinished) { LevelEndTasks.Update(); yield return(null); } LevelEndTasks.Clear(); LevelEndTasks.Add(GetBubbleEscapeTasks()); LevelEndTasks.Add(new WaitTask(StartNewLevelWaitTime)); while (!LevelEndTasks.IsFinished) { LevelEndTasks.Update(); yield return(null); } ClearUseableBubbles(); break; } if (index <= MaxLevelIndex) { levelState = LevelState.SetUp; if (CurrentSaveInfo.CurrentLevel >= MinLevelIndex && Type == LoadLevelType.LevelFinish) { SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex].SetActive(false); Destroy(SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex]); SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex] = CopiedLevel; } CopiedLevel = Instantiate(SortedLevelList[index - MinLevelIndex]); CopiedLevel.transform.parent = AllLevel.transform; CopiedLevel.SetActive(false); SortedLevelList[index - MinLevelIndex].SetActive(true); ActivatedLevel = SortedLevelList[index - MinLevelIndex]; if (Type == LoadLevelType.LevelFinish) { CurrentSaveInfo.LevelFinished[CurrentSaveInfo.CurrentLevel - 1] = true; } CurrentSaveInfo.CurrentLevel = index; SaveProgress(); EventManager.instance.Fire(new LevelLoaded(CurrentSaveInfo.CurrentLevel)); SerialTasks LevelStartUITasks = GetLevelStartTask(); while (!LevelStartUITasks.IsFinished) { LevelStartUITasks.Update(); yield return(null); } levelState = LevelState.Play; EventManager.instance.Fire(new FinishLoadLevel(CurrentSaveInfo.CurrentLevel)); ParallelTasks BackButtonAppearTask = BackButton.GetComponent <GameButton>().GetAppearTask(); while (!BackButtonAppearTask.IsFinished) { BackButtonAppearTask.Update(); yield return(null); } BackButton.GetComponent <BoxCollider2D>().enabled = true; } }
private IEnumerator BackToMainMenu(GameState OriginalState) { gameState = GameState.MainMenu; BackButton.GetComponent <BoxCollider2D>().enabled = false; switch (OriginalState) { case GameState.SelectLevelMenu: SetSelectLevelEnable(false); ParallelTasks SelectLevelDisappearTask = new ParallelTasks(); foreach (Transform child in AllLevelButtons.transform) { SelectLevelDisappearTask.Add(child.GetComponent <GameButton>().GetUnselectedDisappearTask()); } foreach (Transform child in LevelSelectionArrows.transform) { SelectLevelDisappearTask.Add(child.GetComponent <GameButton>().GetUnselectedDisappearTask()); } SelectLevelDisappearTask.Add(BackButton.GetComponent <GameButton>().GetSelectedDisappearTask()); while (!SelectLevelDisappearTask.IsFinished) { SelectLevelDisappearTask.Update(); yield return(null); } break; case GameState.Info: ParallelTasks InfoDisappearTask = new ParallelTasks(); InfoDisappearTask.Add(BackButton.GetComponent <GameButton>().GetSelectedDisappearTask()); InfoDisappearTask.Add(Utility.GetTextDisappearTask(InfoText, ButtonUnselectedDisappearTime)); while (!InfoDisappearTask.IsFinished) { InfoDisappearTask.Update(); yield return(null); } break; case GameState.Setting: MusicMeterCursor.GetComponent <CircleCollider2D>().enabled = false; SoundEffectMeterCursor.GetComponent <CircleCollider2D>().enabled = false; VibrationCheckBox.GetComponent <BoxCollider2D>().enabled = false; SaveConfig(); ParallelTasks SettingDisappearTask = new ParallelTasks(); SettingDisappearTask.Add(BackButton.GetComponent <GameButton>().GetSelectedDisappearTask()); SettingDisappearTask.Add(Utility.GetTextDisappearTask(MusicText, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetTextDisappearTask(SoundEffectText, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetTextDisappearTask(VibrationText, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(MusicMeter, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(MusicMeterCursor, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(SoundEffectMeter, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(SoundEffectMeterCursor, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(VibrationCheckBox, ButtonUnselectedDisappearTime)); SettingDisappearTask.Add(Utility.GetImageDisappearTask(VibrationCheckMark, ButtonUnselectedDisappearTime)); while (!SettingDisappearTask.IsFinished) { SettingDisappearTask.Update(); yield return(null); } break; } ParallelTasks MainMenuAppearTask = new ParallelTasks(); MainMenuAppearTask.Add(Utility.GetTextAppearTask(Title, ButtonAppearTime)); MainMenuAppearTask.Add(PlayButton.GetComponent <GameButton>().GetAppearTask()); MainMenuAppearTask.Add(SelectLevelButton.GetComponent <GameButton>().GetAppearTask()); MainMenuAppearTask.Add(SettingButton.GetComponent <GameButton>().GetAppearTask()); MainMenuAppearTask.Add(CreditButton.GetComponent <GameButton>().GetAppearTask()); while (!MainMenuAppearTask.IsFinished) { MainMenuAppearTask.Update(); yield return(null); } SetMainMenuEnable(true); }
private IEnumerator BackToSelectionMenu() { gameState = GameState.SelectLevelMenu; BackButton.GetComponent <BoxCollider2D>().enabled = false; levelState = LevelState.Clear; SetLevelButtonColor(); ParallelTasks ClearLevelTasks = new ParallelTasks(); SerialTasks LevelEndUITask = GetLevelEndUITask(true); ClearLevelTasks.Add(LevelEndUITask); SerialTasks MapDisappearTask = ActivatedLevel.GetComponent <LevelManager>().GetMapDisappearTask(); ClearLevelTasks.Add(MapDisappearTask); while (!ClearLevelTasks.IsFinished) { ClearLevelTasks.Update(); yield return(null); } yield return(new WaitForSeconds(BackToMenuSelectionMenuAppearGap)); ParallelTasks LevelButtonAppearTasks = new ParallelTasks(); foreach (Transform child in AllLevelButtons.transform) { LevelButtonAppearTasks.Add(child.GetComponent <GameButton>().GetAppearTask()); } foreach (Transform child in LevelSelectionArrows.transform) { LevelButtonAppearTasks.Add(child.GetComponent <GameButton>().GetAppearTask()); } LevelButtonAppearTasks.Add(BackButton.GetComponent <GameButton>().GetAppearTask()); while (!LevelButtonAppearTasks.IsFinished) { LevelButtonAppearTasks.Update(); yield return(null); } BackButton.GetComponent <BoxCollider2D>().enabled = true; ClearUseableBubbles(); SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex].SetActive(false); Destroy(SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex]); SortedLevelList[CurrentSaveInfo.CurrentLevel - MinLevelIndex] = CopiedLevel; gameState = GameState.SelectLevelMenu; SetSelectLevelEnable(true); }
private IEnumerator RollBack() { GameManager.levelState = LevelState.RollBack; List <BubbleChangeInfo> list = ChangeInfoList[ChangeInfoList.Count - 1]; ParallelTasks RollBackTask = new ParallelTasks(); for (int i = 0; i < list.Count; i++) { if (list[i].Placed) { switch (list[i].Type) { case BubbleType.Normal: RollBackTask.Add(new DisappearTask(list[i].Bubble, RollBackTime / 2, list[i].To, Map, list[i].Type, true)); break; } if (Map[list[i].From.x][list[i].From.y].slotType == SlotType.Target) { Map[list[i].From.x][list[i].From.y].Entity.GetComponent <TargetSlotObject>().SetBubbleInside(false); } Color color = list[i].UseableBubble.GetComponent <SpriteRenderer>().color; list[i].UseableBubble.SetActive(true); RollBackTask.Add(new ColorChangeTask(list[i].UseableBubble, Utility.ColorWithAlpha(color, 0), Utility.ColorWithAlpha(color, 1), RollBackTime / 2, ColorChangeType.Sprite)); } else { if (list[i].From.x != list[i].To.x || list[i].From.y != list[i].To.y) { SerialTasks serialTasks = new SerialTasks(); serialTasks.Add(new DisappearTask(list[i].Bubble, RollBackTime / 2, list[i].To, Map, list[i].Type, false)); serialTasks.Add(new TransformTask(list[i].Bubble, list[i].EndPos, list[i].BeginPos, 0)); serialTasks.Add(new AppearTask(list[i].Bubble, RollBackTime / 2, true, list[i].From, Map, list[i].Type)); RollBackTask.Add(serialTasks); if (Map[list[i].To.x][list[i].To.y].slotType == SlotType.Target) { Map[list[i].To.x][list[i].To.y].Entity.GetComponent <TargetSlotObject>().SetBubbleInside(false); } if (Map[list[i].From.x][list[i].From.y].slotType == SlotType.Target) { Map[list[i].From.x][list[i].From.y].Entity.GetComponent <TargetSlotObject>().ClearInsideParticleInfo(); Map[list[i].From.x][list[i].From.y].Entity.GetComponent <TargetSlotObject>().SetBubbleInside(true); } } } } while (!RollBackTask.IsFinished) { RollBackTask.Update(); yield return(null); } ChangeInfoList.Remove(list); GameManager.levelState = LevelState.Play; }