IEnumerator ChainReaction() { Stuff raiden = null; float distanceMin = float.MaxValue; foreach (var stuff in Factory.LIVE_STUFF) { if (stuff != null && stuff is CatRaiden) { float distance = DistanceTo(stuff); if (distance < distanceMin) { distanceMin = distance; raiden = stuff; } } } if (raiden != null) { Factory.LIVE_STUFF.Remove(raiden); Lightning.Create(raiden, this); } yield return(new WaitForSeconds(0.1f)); shape.enabled = false; //ShakeAndDestroy(); Destroy(rb); iTween.ScaleTo(gameObject, iTween.Hash("x", 0, "y", 0, "easeType", "easeInBack", "time", 0.3f)); Destroy(gameObject, 1f); Bomb(radius); if (raiden != null) { yield return(new WaitForSeconds(0.3f)); raiden.Activate(Vector2.zero); } }
IEnumerator Timer() { if (isTNT && !user.IsTutorialShown(Tutorial.Part.GameBasics)) { ui.PopupShow(ui.text); yield return(new WaitForSeconds(0.45f)); ui.tutorial.Show(new List <Tutorial.Part>() { Tutorial.Part.GameBasics1, Tutorial.Part.GameBasics2, Tutorial.Part.GameBasics3, Tutorial.Part.GameBasics4 }); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } factory.CreateCatsBasic(balance.catsInGame); yield return(new WaitForSeconds(1.5f)); } else { factory.CreateCatsBasic(balance.catsInGame); ui.PopupShow(ui.text); yield return(new WaitForSeconds(0.6f)); } if (isTNT && !user.IsTutorialShown(Tutorial.Part.GameBasics)) { ui.tutorial.Show(new List <Tutorial.Part>() { Tutorial.Part.GameBasics5, Tutorial.Part.GameBasics6, Tutorial.Part.GameBasics }); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (!user.IsTutorialShown(Tutorial.Part.GameBasics)) { ui.tutorial.Show(Tutorial.Part.GameBasics); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (!user.IsTutorialShown(Tutorial.Part.GameCombo)) { ui.tutorial.Show(Tutorial.Part.GameCombo); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.BOX_UNLOCK_LEVELS[0] && user.useCats == 0 && ui.prepare.catSlots[0].catItem != null) { ui.tutorial.Show(Tutorial.Part.CatUse); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (!user.IsTutorialShown(Tutorial.Part.Fever) && Missions.isFever) { if (isTNT) { ui.tutorial.Show(new List <Tutorial.Part>() { Tutorial.Part.Fever1, Tutorial.Part.Fever }); } else { ui.tutorial.Show(Tutorial.Part.Fever); } while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.COMBO_LOOP_LEVEL && user.loopLength == 0) { ui.tutorial.Show(Tutorial.Part.GameComboLoop); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.FIREWORK_BOOM_SMALL_LEVEL && user.useFireworkBoomSmall == 0) { ui.tutorial.Show(Tutorial.Part.FireworkBoomSmall); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.FIREWORK_ROCKET_LEVEL && user.useFireworkRocket == 0) { ui.tutorial.Show(Tutorial.Part.FireworkRocket); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.FIREWORK_BOOM_BIG_LEVEL && user.useFireworkBoomBig == 0) { ui.tutorial.Show(Tutorial.Part.FireworkBoomBig); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.FIREWORK_COLOR_LEVEL && user.useFireworkColor == 0) { ui.tutorial.Show(Tutorial.Part.FireworkColor); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (user.level == Missions.MULTIPLIER_X5_LEVEL && user.getMultiplier < 5) { ui.tutorial.Show(Tutorial.Part.MultiplierX5); while (ui.tutorial.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } else if (ui.rentCat.isTimeToRentCat && !build.premium) { ui.rentCat.Show(ui.prepare.freeCatSlot); while (ui.rentCat.gameObject.activeSelf) { yield return(new WaitForEndOfFrame()); } } music.Switch(music.game, 3); sound.PlayVoice(sound.voiceClips.ready); ui.text.mainText.text = Localization.Get("beforeGameReady"); ui.text.mainText.transform.localScale = UI.halfVector3; iTween.ScaleTo(ui.text.mainText.gameObject, Vector3.one, 0.4f); yield return(new WaitForSeconds(sound.voiceClips.readyTime)); sound.PlayVoice(sound.voiceClips.set); ui.text.mainText.text = Localization.Get("beforeGameSet"); ui.text.mainText.transform.localScale = UI.halfVector3; iTween.ScaleTo(ui.text.mainText.gameObject, Vector3.one, 0.4f); yield return(new WaitForSeconds(sound.voiceClips.setTime)); sound.PlayVoice(sound.voiceClips.cat); ui.text.mainText.text = Localization.Get("beforeGameCat"); ui.text.mainText.transform.localScale = UI.halfVector3; iTween.ScaleTo(ui.text.mainText.gameObject, Vector3.one, 0.4f); yield return(new WaitForSeconds(sound.voiceClips.catTime)); Missions.OnGameStart(); ui.game.InitSlots(); ui.PopupShow(ui.game); StartCoroutine("FeverManager"); StartCoroutine("ScoreManager"); StartCoroutine("ChainHighlightManager"); if (isRiki) { StartCoroutine("RikiAnimationManager"); } if (boosts.firework.ON) { factory.CreateFirework(factory.fireworkPrefabs.color, Vector3.zero); } while (seconds > 0) { yield return(new WaitForSeconds(1f)); seconds--; // GC.Collect(); // LogDebug("LIVE = {0}, POOL = {1}, ALL = {2}", Factory.LIVE_STUFF.Count, Factory.POOL_CATS.Count, Factory.STUFF.Count); while (isPause) { yield return(new WaitForEndOfFrame()); } if (isTimeFreezed) { ui.game.FreezeShow(); } while (isTimeFreezed) { while (isPause) { yield return(new WaitForEndOfFrame()); } yield return(new WaitForSeconds(1f)); freezedSeconds--; if (!isTimeFreezed) { ui.game.FreezeHide(); } } if (seconds < 9 && !ui.game.isAlertON) { ui.game.AlertON(); } else if (seconds > 10 && ui.game.isAlertON) { ui.game.AlertOFF(); } } isPlaying = false; if (CatBasic.CHAIN.Count > 0) { CatBasic.CHAIN[CatBasic.CHAIN.Count - 1].ChainEnd(); // Распускаем цепочку } ui.game.AlertOFF(); music.TurnOff(2f); sound.PlayVoice(sound.voiceClips.timeIsOut); ui.PopupShow(ui.text); ui.text.mainText.text = Localization.Get("timeIsUp"); ui.text.mainText.transform.localScale = UI.halfVector3; iTween.ScaleTo(ui.text.mainText.gameObject, Vector3.one, 0.4f); yield return(new WaitForSeconds(2f)); Stuff stuffToActivate = null; foreach (Stuff stuff in Factory.LIVE_STUFF) { if (stuff is Firework || stuff.GetType().IsSubclassOf(typeof(CatSuper)) || stuff is CatJoker || stuff is CatJokerRiki) { stuffToActivate = stuff; break; } } if (stuffToActivate != null) { ui.text.mainText.gameObject.SetActive(false); ui.game.multiplierText.transform.SetParent(ui.text.transform, true); ui.game.scoreText.transform.SetParent(ui.text.transform, true); while (true) { Factory.LIVE_STUFF.Remove(stuffToActivate); stuffToActivate.Activate(Vector2.zero); stuffToActivate = null; foreach (Stuff stuff in Factory.LIVE_STUFF) { if (stuff is Firework || stuff.GetType().IsSubclassOf(typeof(CatSuper)) || stuff is CatJoker || stuff is CatJokerRiki) { stuffToActivate = stuff; break; } } if (stuffToActivate != null) { yield return(new WaitForSeconds(0.4f)); } else { break; } } yield return(new WaitForSeconds(2f)); ui.text.mainText.gameObject.SetActive(true); ui.game.multiplierText.transform.SetParent(ui.game.add.transform, true); ui.game.scoreText.transform.SetParent(ui.game.add.transform, true); } ui.text.mainText.text = string.Empty; ClearGame(); oldPermanentRecord = user.permanentRecord; oldCoins = user.coins; if (user.level > 0) { user.UpdateRecord(score); } user.UpdateCoins(coins, true); achievements.OnGameEnd(); Missions.OnGameEnd(); Analytic.EventPropertiesImportant(AnalyticsManager.Names.Game, new Dictionary <string, object> { { "Score", Analytic.Round(score).SpaceFormat() }, { "Goldfishes", Analytic.Round(coins).SpaceFormat() }, { "Multiplier " + Missions.maxMultiplier, multiplier.ToString() }, }); music.Switch(music.result); if (ui.rentCat.catItem != null) { ui.rentCatBuy.Show(OpenNext); } else { OpenNext(); } }