StoryM.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using DG.Tweening;
  4. using UnityEngine;
  5. using UnityEngine.Localization.Settings;
  6. using UnityEngine.UI;
  7. using System.Linq;
  8. public class StoryM : MonoBehaviour {
  9. // 文本
  10. public Text textStory;
  11. public RectTransform shapeBack;
  12. /// <summary>
  13. /// 设置旁白,并返回预期时间。旁白字幕将在预期时间后消失。
  14. /// </summary>
  15. public float SetStoryText(string textCn, string textEn = "English") {
  16. AudioM.Play("sub");
  17. bool isCn = LocalizationSettings.SelectedLocale.LocaleName == "Chinese (Simplified) (zh-CN)";
  18. textStory.text = isCn ? textCn : textEn;
  19. LayoutRebuilder.ForceRebuildLayoutImmediate(textStory.rectTransform);
  20. // 动画
  21. DOTween.Kill("StoryBackground"); shapeBack.DOScaleX((textStory.rectTransform.rect.width + 40f) / 100f, 0.3f).SetEase(Ease.OutSine).SetId("StoryBackground");
  22. textStory.text = "";
  23. DOTween.Kill("StoryText"); textStory.DOText(isCn ? textCn : textEn, 0.3f).SetEase(Ease.OutSine).SetId("StoryText");
  24. // 消失
  25. float time = 1f + (isCn ? textCn.Length / 3f : textEn.Split(" ").Length / 4f);
  26. StopCoroutine("WaitForHideStoryText"); StartCoroutine("WaitForHideStoryText", time);
  27. Debug.Log(time + " -> " + textCn);
  28. return time;
  29. }
  30. IEnumerator WaitForStoryText(string textCh, string textEn = "English") {
  31. yield return new WaitForSeconds(SetStoryText(textCh, textEn));
  32. }
  33. IEnumerator WaitForHideStoryText(float delay) {
  34. yield return new WaitForSeconds(delay);
  35. Debug.Log("隐藏:" + delay);
  36. HideStoryText();
  37. }
  38. void HideStoryText() {
  39. StopCoroutine("WaitForHideStoryText");
  40. textStory.text = "";
  41. DOTween.Kill("StoryBackground"); shapeBack.DOScaleX(0, 0.2f).SetId("StoryBackground");
  42. DOTween.Kill("StoryText");
  43. }
  44. // 刷怪
  45. private Dictionary<Spawner.EnemyType, List<Spawner>> spawners = null;
  46. public void Spawn(Spawner.EnemyType type, int count = 1) {
  47. // 初始化
  48. if (spawners == null) {
  49. spawners = new();
  50. foreach (Spawner spawner in FindObjectsOfType<Spawner>()) {
  51. if (spawners.ContainsKey(spawner.type)) {
  52. spawners[spawner.type].Add(spawner);
  53. } else {
  54. spawners[spawner.type] = new() { spawner };
  55. }
  56. }
  57. }
  58. // 实际刷怪
  59. spawners[type].Shuffle();
  60. int id = 0;
  61. for (int i = 0; i < count; i++) {
  62. if (id >= spawners[type].Count) id = 0;
  63. spawners[type][id].Spawn();
  64. id++;
  65. }
  66. }
  67. // 流程控制
  68. IEnumerator WaitUntilClear(int remain, float waitTime = -1, string textCn = "", string textEn = "") {
  69. int targetStage = stage;
  70. while (GetEnemyCount() > remain && !respawning && targetStage == stage) {
  71. if (waitTime >= 0f && waitTime < 0.3f) SetStoryText(textCn, textEn);
  72. waitTime -= 0.3f;
  73. yield return new WaitForSeconds(0.3f);
  74. }
  75. }
  76. int GetEnemyCount() => FindObjectsOfType<EnemyBase>().Length - FindObjectsOfType<EnemyArrow>().Length;
  77. IEnumerator WaitUntilPickDice(float waitTime = -1, string textCn = "", string textEn = "") {
  78. int targetStage = stage;
  79. while (GetDiceCount() > 0 && !respawning && targetStage == stage) {
  80. if (waitTime >= 0f && waitTime < 0.3f) SetStoryText(textCn, textEn);
  81. waitTime -= 0.3f;
  82. yield return new WaitForSeconds(0.3f);
  83. }
  84. }
  85. int GetDiceCount() => FindObjectsOfType<DiceEntity>().Count(dice => !dice.pickedUp);
  86. // 故事
  87. public int stage = 0; private bool stageCompleted = true;
  88. public GameObject panDeath, panWin1, panWin2;
  89. void Start() {
  90. StartCoroutine("ArrowSpawner");
  91. StartCoroutine("Main");
  92. }
  93. IEnumerator Main() {
  94. while (true) {
  95. if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyUp(KeyCode.Q)) {
  96. SetStoryText("已跳过阶段:" + stage, "Skip Stage: " + stage);
  97. stageCompleted = true;
  98. }
  99. if (Player.hp <= 0) {
  100. stageCompleted = false;
  101. yield return StartCoroutine("Respawn");
  102. }
  103. if (stageCompleted) {
  104. deathInStage = 0;
  105. stageCompleted = false;
  106. StopCoroutine("Stage" + stage);
  107. stage++;
  108. Debug.Log("已到达阶段:" + stage);
  109. StartCoroutine("Stage" + stage);
  110. }
  111. yield return new WaitForFixedUpdate();
  112. }
  113. }
  114. private int deathInStage = 0; private bool respawning = false, noDifficulty = false;
  115. IEnumerator Respawn() {
  116. AudioM.Play("player_die");
  117. deathInStage++; respawning = true;
  118. // 停止场景
  119. arrowMax = 0;
  120. Player.instance.transform.localScale = Vector3.zero;
  121. Player.instance.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
  122. Player.instance.enabled = false;
  123. StopCoroutine("Stage" + stage);
  124. StopCoroutine("HideStoryText");
  125. yield return new WaitForSeconds(1.5f);
  126. if (stage == 16 && deathInStage % 3 == 1) {
  127. SetStoryText("嘿,你可以蹲下来躲避飞在天上的螺圈!", "Hey, you can dodge these flying coils by crouching down!");
  128. } else if (!noDifficulty) {
  129. _ = Modules.randomDefault.Next(0, 6) switch {
  130. 0 => SetStoryText("完了,寄咯!", "Woops, you died!"),
  131. 1 => SetStoryText("哦吼,下辈子加油吧", "Ouch, work harder next life!"),
  132. 2 => SetStoryText("诶,怎么回事?", "Yo, what's happening?"),
  133. 3 => SetStoryText("还好我没开极限模式……", "Luckily I didn't have hardcore mode on..."),
  134. 4 => SetStoryText("那叫啥来着……保持你的决心!", "What's that called... KEEP YOUR DETERMINATION!"),
  135. 5 => SetStoryText("嗨呀,再多试试吧,能过的啦", "Hey, try again, you can do it!"),
  136. _ => throw new System.NotImplementedException(),
  137. };
  138. } else {
  139. _ = Modules.randomDefault.Next(0, 3) switch {
  140. 0 => SetStoryText("不是吧?不至于吧?", "What? How?"),
  141. 1 => SetStoryText("你是特么故意的吧!", "Are you doing this on purpose?"),
  142. 2 => SetStoryText("嗯?", "Hey!"),
  143. _ => throw new System.NotImplementedException(),
  144. };
  145. }
  146. yield return new WaitForSeconds(0.5f);
  147. // 转为黑屏
  148. panDeath.GetComponent<Image>().DOFade(1, 0.3f); panDeath.GetComponentInChildren<TMPro.TextMeshProUGUI>().DOFade(1, 1f);
  149. yield return new WaitForSeconds(0.3f);
  150. // 复原
  151. FindObjectsOfType<EnemyBase>().ToList().ForEach(e => Modules.DestroyGameObject(e.gameObject));
  152. Player.hp = 3;
  153. Player.instance.currentBullet = Player.instance.maxBullet;
  154. yield return new WaitForSeconds(3f);
  155. // 淡出黑屏,玩家重生
  156. respawning = false;
  157. panDeath.GetComponent<Image>().DOFade(0, 0.8f); panDeath.GetComponentInChildren<TMPro.TextMeshProUGUI>().DOFade(0, 0.3f);
  158. Player.instance.enabled = true;
  159. Player.instance.transform.localScale = Vector3.one;
  160. Player.instance.transform.position = new Vector3(-6, 10, 0);
  161. // 继续游戏
  162. yield return new WaitForSeconds(2f);
  163. StartCoroutine("Stage" + stage);
  164. }
  165. IEnumerator Stage1() {
  166. arrowMax = 0; noDifficulty = false;
  167. yield return new WaitForSeconds(3f);
  168. yield return StartCoroutine(WaitForStoryText("哦,哦!你好,欢迎欢迎", "Oh, oh! Hello there!"));
  169. yield return StartCoroutine(WaitForStoryText("先来过个教程啥的吧", "Let's go through a quick tutorial before we start."));
  170. yield return StartCoroutine(WaitForStoryText("游戏的按键操作写在了右上角,应该是个人都看得懂", "All control buttons are shown on the top-right corner. I bet nobody can't understand that."));
  171. SetStoryText("你不如先拿它们俩试试按键吧!", "Now, let's try some buttons with these two cute guys!");
  172. Spawn(Spawner.EnemyType.Mover, 2);
  173. yield return StartCoroutine(WaitUntilClear(0, 15f, "快点把它干掉,然后才好继续……", "Come on! You have to defeat them to continue..."));
  174. stageCompleted = true;
  175. }
  176. IEnumerator Stage2() {
  177. arrowMax = 1; noDifficulty = false;
  178. Spawn(Spawner.EnemyType.Mover, 2);
  179. yield return StartCoroutine(WaitForStoryText("哦,还剩下最后一条教程……", "Oh, a final reminder before I leave..."));
  180. Spawn(Spawner.EnemyType.Mover, deathInStage <= 0 ? 2 : 1);
  181. yield return StartCoroutine(WaitForStoryText("“弹药不够的时候记得右键换弹!”", "Don't forget to reload the weapon using right click before you run out of ammo!"));
  182. Spawn(Spawner.EnemyType.Shooter, 1);
  183. Spawn(Spawner.EnemyType.Mover, 1);
  184. <<<<<<< HEAD
  185. SetStoryText("加油,新手教程结束了!", "There you go, that's end of the tutorial!");
  186. =======
  187. SetStoryText("加油,新手教程结束了!", "There you go, that's end of the tutorial.");
  188. >>>>>>> origin/master
  189. yield return StartCoroutine(WaitUntilClear(1, 8f, "仔细一看,这个角色的手上连枪都没有……", "Hmm... He does not even have a gun in his hand after a closer look."));
  190. if (Player.hp < 3) {
  191. Player.hp = 3;
  192. Spawn(Spawner.EnemyType.Mover, 1);
  193. yield return StartCoroutine(WaitForStoryText("对了,教程结束得先给你回个血……", "Whoops, I almost forgot to heal you after the tutorial."));
  194. }
  195. stageCompleted = true;
  196. }
  197. IEnumerator Stage3() {
  198. arrowMax = 3; noDifficulty = false;
  199. Spawn(Spawner.EnemyType.Mover, 3);
  200. yield return new WaitForSeconds(5f);
  201. yield return StartCoroutine(WaitForStoryText("说实话啊,我感觉这个游戏有点……敷衍", "To be honest, I think this game is kind of perfunctory..."));
  202. Spawn(Spawner.EnemyType.Mover, 1);
  203. yield return StartCoroutine(WaitForStoryText("我看了看,这游戏往后的新内容就只剩一种换皮怪了!", "Let's see... We only have one more new enemy with ONLY new skin!"));
  204. Spawn(Spawner.EnemyType.Mover, 1);
  205. yield return StartCoroutine(WaitForStoryText("除此之外就只剩无尽模式了……但无尽模式谁玩啊?", "And then, all we have is endless mode... But who plays endless mode?"));
  206. Spawn(Spawner.EnemyType.Shooter, 1);
  207. yield return StartCoroutine(WaitForStoryText("没有升级,没有装备,没有峰回路转的牛逼剧情", "No upgrade, no equipments, no twist to the plot..."));
  208. Spawn(Spawner.EnemyType.Mover, 1);
  209. yield return StartCoroutine(WaitForStoryText("并且最重要的是,说好的“丢骰子”呢?", "And most importantly, where's \"Roll of the Dice\"?"));
  210. yield return StartCoroutine(WaitForStoryText("骰子、骰子……让我找找哪儿有骰子……?", "Dice... Dice... Where is the dice...?"));
  211. SetStoryText("这个游戏里一个骰子都没有!", "Not a single dice in this game!");
  212. arrowMax = 0;
  213. Spawn(Spawner.EnemyType.Mover, deathInStage <= 0 ? 2 : 1);
  214. yield return StartCoroutine(WaitUntilClear(0, 6f, "切题呢?作者到底咋想的?", "What's the point? What's wrong with this author?"));
  215. noDifficulty = true;
  216. yield return StartCoroutine(WaitForStoryText("要不然这样,我们随便拿个东西,把它弄成骰子算了", "How about we just grab something and make it a dice?"));
  217. yield return new WaitForSeconds(2f);
  218. InputM.DropDice(InputM.KeyType.Fire);
  219. SetStoryText("嘿,成了!", "Let's go!");
  220. stageCompleted = true;
  221. }
  222. IEnumerator Stage4() {
  223. arrowMax = 0; noDifficulty = true;
  224. yield return StartCoroutine(WaitUntilPickDice(8f, "看到右边掉下来的东西了么?把它捡起来摇一摇!", "You see the falling stuff on the right? Pick it up and try shaking it!"));
  225. stageCompleted = true;
  226. }
  227. IEnumerator Stage5() {
  228. arrowMax = 0; noDifficulty = true;
  229. yield return new WaitForSeconds(1f);
  230. yield return StartCoroutine(WaitForStoryText("噔噔噔……!", "Ding ding ding!"));
  231. yield return new WaitForSeconds(7f);
  232. yield return StartCoroutine(WaitForStoryText("你看,这就是天才制作的骰子", "See, what a genius-made dice!"));
  233. yield return new WaitForSeconds(1.5f);
  234. Spawn(Spawner.EnemyType.Mover, 1);
  235. if (Player.hp < 3) {
  236. Player.hp = 3;
  237. yield return StartCoroutine(WaitForStoryText("让我帮你回个血,我们继续!", "Let me heal you first and then keep going!"));
  238. } else {
  239. yield return StartCoroutine(WaitForStoryText("来,我们继续!", "Let's keep going!"));
  240. }
  241. stageCompleted = true;
  242. }
  243. IEnumerator Stage6() {
  244. arrowMax = 1; noDifficulty = false;
  245. Spawn(Spawner.EnemyType.Mover, 3);
  246. yield return StartCoroutine(WaitUntilClear(1, 8f, "骰子有六面,按键有六个,简直完美!", "Six sides to six buttons, perfect!"));
  247. Spawn(Spawner.EnemyType.Shooter, 1);
  248. yield return StartCoroutine(WaitForStoryText("感觉如何?", "How do you feel?"));
  249. arrowMax = deathInStage <= 1 ? 3 : 1;
  250. yield return StartCoroutine(WaitForStoryText("是不是还想马上再来一颗?", "Want to have another dice now?"));
  251. Spawn(Spawner.EnemyType.Mover, 2);
  252. yield return StartCoroutine(WaitForStoryText("但如果给你太多骰子,那岂不是显得它很……普通", "But if I give you too many dice, it will look... ordinary."));
  253. arrowMax = 3;
  254. Spawn(Spawner.EnemyType.Shooter, 1);
  255. yield return StartCoroutine(WaitForStoryText("不如让我们先等等,我先给你看看之前说的新敌人", "Why don't we wait while I show you the new enemy we were talking about...?"));
  256. SetStoryText("额……就是换皮的那个", "Ugh... That enemy with ONLY new skin.");
  257. Spawn(Spawner.EnemyType.Mover, 1);
  258. yield return StartCoroutine(WaitUntilClear(1, 6f, "别抱太大期望就是了……", "So just don't hope too much on that..."));
  259. stageCompleted = true;
  260. }
  261. IEnumerator Stage7() {
  262. arrowMax = 0; noDifficulty = false;
  263. yield return StartCoroutine(WaitForStoryText("让我找找那个换皮怪在哪……", "Hold on... I can't find where that enemy is."));
  264. yield return new WaitForSeconds(1.5f);
  265. SetStoryText("卧槽!小心!", "Geez! Watch out!");
  266. for (int i = 0; i < Mathf.Max(6, 15 - deathInStage * 2); i++) {
  267. Spawn(Spawner.EnemyType.Mover, 1);
  268. yield return new WaitForSeconds(0.4f);
  269. }
  270. yield return StartCoroutine(WaitForStoryText("我把圆锯片的仓库弄漏了……", "I mix up the wrong repository for saw blades..."));
  271. yield return StartCoroutine(WaitForStoryText("明明打算之后给宫殿做点装饰的,唉", "Aww... I was gonna use it for decoration in the palace later."));
  272. yield return StartCoroutine(WaitUntilClear(6, 6f, "出了这么大问题,玩家给游戏打差评怎么办?", "What if players give bad reviews of this game with such a big issue?"));
  273. if (Player.hp < 3) {
  274. Player.hp = 3;
  275. yield return StartCoroutine(WaitForStoryText("我帮你回个血吧……唉,惹麻烦了……", "Aww, that's a huge trouble... Let me heal you first."));
  276. } else {
  277. yield return StartCoroutine(WaitForStoryText("唉,惹麻烦了……", "Aww, that's a huge trouble..."));
  278. }
  279. yield return StartCoroutine(WaitUntilClear(3, 6f, "我的锯片……", "My saw blades..."));
  280. yield return StartCoroutine(WaitForStoryText("要不然……我再给你一颗特制按键骰子™作为补偿?", "How about... I give you another specially made Button Dice™ for compensation?"));
  281. yield return new WaitForSeconds(1f);
  282. InputM.DropDice(new List<InputM.KeyType>() { InputM.KeyType.Left, InputM.KeyType.Right, InputM.KeyType.Crouch }.RandomOne());
  283. SetStoryText("你的补偿来了!", "Here is your compensation!");
  284. stageCompleted = true;
  285. }
  286. IEnumerator Stage8() {
  287. arrowMax = 0; noDifficulty = true;
  288. yield return StartCoroutine(WaitUntilPickDice(10f, "难道说你不喜欢特制按键骰子™吗?别吧", "Come on! Don't tell me you don't like my Button Dice™!"));
  289. stageCompleted = true;
  290. }
  291. IEnumerator Stage9() {
  292. arrowMax = 0; noDifficulty = true;
  293. yield return new WaitForSeconds(7f);
  294. stageCompleted = true;
  295. }
  296. IEnumerator Stage10() {
  297. arrowMax = deathInStage <= 2 ? 2 : 0; noDifficulty = false;
  298. yield return StartCoroutine(WaitForStoryText("唔,看起来特制按键骰子™的威力还挺大……", "Hmm, looks like the Button Dice™ is pretty powerful..."));
  299. Spawn(Spawner.EnemyType.Mover, deathInStage <= 0 ? 4 : 3);
  300. yield return new WaitForSeconds(1.5f);
  301. SetStoryText("呼,圆锯片看起来也还剩了不少", "Whew, seems to have a lot saw blades left.");
  302. yield return StartCoroutine(WaitUntilClear(1, 12f, "哇哦……", "Wow!"));
  303. Spawn(Spawner.EnemyType.Shooter, deathInStage <= 1 ? 3 : 2);
  304. yield return StartCoroutine(WaitForStoryText("看起来我低估了骰子™的……", "It seems that I have under underestimate the Button Dice™'s..."));
  305. SetStoryText("刺激程度", "Intensity.");
  306. yield return StartCoroutine(WaitUntilClear(2, 12f, "这不比原来好玩多了嘛!", "Isn't this more fun than before?"));
  307. stageCompleted = true;
  308. }
  309. IEnumerator Stage11() {
  310. arrowMax = 2; noDifficulty = false;
  311. yield return StartCoroutine(WaitForStoryText("既然骰子™能为游戏的玩法带来颠覆性的体验", "Since Dice™ can bring such a revolutionary experience to the gameplay..."));
  312. SetStoryText("那我们为啥不再立即多来几颗呢?这不是摆明了越多骰子™就越好玩么?", "So why don't we just get a few more Dice™ now? Wouldn't more Dice™ be more fun?");
  313. Spawn(Spawner.EnemyType.Heavy, deathInStage <= 0 ? 2 : 1);
  314. yield return new WaitForSeconds(1f);
  315. yield return StartCoroutine(WaitForStoryText("哈?", "Hah?"));
  316. arrowMax = 4;
  317. Spawn(Spawner.EnemyType.Heavy, 1);
  318. yield return StartCoroutine(WaitForStoryText("螺母怎么在这个时候出来了?", "How did the nut come out at this time?"));
  319. Spawn(Spawner.EnemyType.Shooter, deathInStage <= 1 ? 2 : 1);
  320. yield return StartCoroutine(WaitForStoryText("额……它就是我之前说的那个换皮怪", "Ugh... That's the monster what we talking about."));
  321. Spawn(Spawner.EnemyType.Heavy, deathInStage <= 1 ? 2 : 1);
  322. yield return StartCoroutine(WaitForStoryText("但它就是最后一种敌人了!", "But it will be our final type of enemies!"));
  323. SetStoryText("没有新敌人、没有新机制……", "No more new enemies, no more new mechanics...");
  324. yield return StartCoroutine(WaitUntilClear(1, 10f, "今天真是诸事不宜……", "What an awful day..."));
  325. stageCompleted = true;
  326. }
  327. IEnumerator Stage12() {
  328. arrowMax = 0; noDifficulty = true;
  329. Spawn(Spawner.EnemyType.Shooter, 1);
  330. yield return StartCoroutine(WaitForStoryText("如果没有悬念,那玩家就会直接 Alt+F4 走人了", "If there is no suspense, the player will just press Alt+F4 to leave"));
  331. yield return StartCoroutine(WaitForStoryText("不行……", "No..."));
  332. SetStoryText("我们需要更多的特制按键骰子™!", "We need more special Button Dice™!");
  333. yield return new WaitForSeconds(1.5f);
  334. InputM.DropDice(new List<InputM.KeyType>() { InputM.KeyType.Jump, InputM.KeyType.Reload }.RandomOne());
  335. stageCompleted = true;
  336. }
  337. IEnumerator Stage13() {
  338. arrowMax = 0; noDifficulty = true;
  339. yield return StartCoroutine(WaitUntilPickDice(10f, "拜托,我就只剩下骰子™了,你不捡还能干什么?", "Come on, all I have is Dice™. What else can you do if you don't pick them up?"));
  340. stageCompleted = true;
  341. }
  342. IEnumerator Stage14() {
  343. arrowMax = 0; noDifficulty = true;
  344. yield return new WaitForSeconds(8f);
  345. stageCompleted = true;
  346. }
  347. IEnumerator Stage15() {
  348. arrowMax = 2; noDifficulty = false;
  349. Spawn(Spawner.EnemyType.Shooter, deathInStage <= 1 ? 2 : 1);
  350. yield return StartCoroutine(WaitForStoryText("哇……三个骰子的威力……", "Wow, the power of three dice..."));
  351. Spawn(Spawner.EnemyType.Mover, deathInStage <= 0 ? 3 : 2);
  352. yield return new WaitForSeconds(5f);
  353. Spawn(Spawner.EnemyType.Mover, 1);
  354. if (Player.hp < 3) {
  355. Player.hp = 3; arrowMax = 1;
  356. yield return StartCoroutine(WaitForStoryText("咳咳,总之,先帮你回个血吧", "Ahem... Anyway, let me heal you first."));
  357. } else {
  358. yield return StartCoroutine(WaitForStoryText("比我想像中的要猛啊……", "That was a lot harder than I thought..."));
  359. }
  360. yield return new WaitForSeconds(2f);
  361. SetStoryText("好吧,我承认我可能做得有点过火了……", "Okay, I admit I may have gone a bit too far...");
  362. yield return StartCoroutine(WaitUntilClear(2, 10f, "骰子™可能让我太兴奋了……", "I'm probably too excited about the Dice™..."));
  363. Spawn(Spawner.EnemyType.Heavy, 1);
  364. yield return StartCoroutine(WaitForStoryText("我保证!我之后不会再放那么多骰子™了!", "I promise! I will not put that many Dice™ again!"));
  365. yield return new WaitForSeconds(3f);
  366. stageCompleted = true;
  367. }
  368. IEnumerator Stage16() {
  369. arrowMax = Mathf.Max(3, 5 - deathInStage); arrowTime = 1.5f + deathInStage * 0.1f; noDifficulty = false;
  370. yield return StartCoroutine(WaitForStoryText("诶?", "Eh?"));
  371. yield return StartCoroutine(WaitForStoryText("我们似乎到 BOSS 关卡了", "I think we're at the boss level."));
  372. Spawn(Spawner.EnemyType.Shooter, 1);
  373. yield return new WaitForSeconds(3f);
  374. yield return StartCoroutine(WaitForStoryText("似乎……就是一堆螺圈满天飞?倒也符合这游戏的尿性", "Well... just a bunch of coils flying over the sky? At least it fits the nature of this game."));
  375. Spawn(Spawner.EnemyType.Mover, 2);
  376. yield return new WaitForSeconds(3f);
  377. yield return StartCoroutine(WaitForStoryText("打完 BOSS 关后,就进入无尽模式了", "After finishing the boss level, you will enter the endless mode."));
  378. Spawn(Spawner.EnemyType.Shooter, 1);
  379. yield return StartCoroutine(WaitForStoryText("嗯……就是敌人会出现得越来越快啊,有个计时器啊,巴拉巴拉", "Hmm... it's just enemies will appear faster and faster, and there will be a timer, blablabla..."));
  380. yield return StartCoroutine(WaitUntilClear(0, 10f, "说起来这游戏又没排行榜,那计时器有啥意义?", "Speaking of the timer, what's the point if there's not a leaderboard?"));
  381. stageCompleted = true;
  382. }
  383. IEnumerator Stage17() {
  384. arrowMax = 0; noDifficulty = true;
  385. yield return StartCoroutine(WaitForStoryText("反正,无尽模式差不多就是这么回事", "Anyway, that's pretty much what the endless mode is..."));
  386. yield return new WaitForSeconds(3f);
  387. yield return StartCoroutine(WaitForStoryText("嗯?螺圈停了?结束了?", "Huh? Did the coil stop? Is this the end?"));
  388. yield return new WaitForSeconds(1f);
  389. SetStoryText("那么,在开始无尽模式之前……!", "So, before we start the endless mode...!");
  390. yield return new WaitForSeconds(1f);
  391. InputM.DropDice(new List<InputM.KeyType>() { InputM.KeyType.Left, InputM.KeyType.Right }.RandomOne(), DiceEntity.DiceType.Bad);
  392. stageCompleted = true;
  393. }
  394. IEnumerator Stage18() {
  395. arrowMax = 0; noDifficulty = true;
  396. yield return StartCoroutine(WaitUntilPickDice(3f, "无尽模式里我肯定不会再丢骰子™了,真的!", "I'm definitely not going to roll the Dice™ again in the endless mode, really!"));
  397. stageCompleted = true;
  398. }
  399. IEnumerator Stage19() {
  400. arrowMax = 0; noDifficulty = true;
  401. yield return new WaitForSeconds(11f);
  402. yield return StartCoroutine(WaitForStoryText("呃……", "Ueh..."));
  403. yield return new WaitForSeconds(5f);
  404. yield return StartCoroutine(WaitForStoryText("这可……不太妙……", "That's... not good..."));
  405. yield return new WaitForSeconds(3f);
  406. yield return StartCoroutine(WaitForStoryText("后面还有无尽模式啊!无尽模式!这样可怎么玩?", "There is an endless mode after this! Endless mode! How can this be played?"));
  407. yield return StartCoroutine(WaitForStoryText("这可咋整啊?", "What should I do?"));
  408. yield return new WaitForSeconds(2f);
  409. SetStoryText("不行!我再想想办法,如果再重新丢一次骰子™,指不定就好了呢?丢一次不行就两次,对吧?", "No way! Let me think about it... What if I can fix it by rolling the Dice™ again?");
  410. yield return new WaitForSeconds(1.5f);
  411. // 结束动画
  412. respawning = true;
  413. Player.instance.transform.localScale = Vector3.zero;
  414. Player.instance.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
  415. Player.instance.enabled = false;
  416. panWin1.SetActive(true);
  417. yield return new WaitForSeconds(1f);
  418. yield return StartCoroutine(WaitForStoryText("诶?喂?", "Aye? Hello?"));
  419. SetStoryText("无尽模式呢?", "Where is the endless mode?");
  420. yield return new WaitForSeconds(6f);
  421. panWin1.SetActive(false); panWin2.SetActive(true);
  422. Text credit = panWin2.GetComponentInChildren<Text>();
  423. string creditText = credit.text;
  424. credit.text = "";
  425. credit.DOText(creditText, 25f).SetEase(Ease.Linear);
  426. }
  427. int arrowMax = 0; float arrowTime = 4f;
  428. IEnumerator ArrowSpawner() {
  429. while (true) {
  430. yield return new WaitForSeconds(arrowTime);
  431. if (arrowMax > 0) Spawn(Spawner.EnemyType.Arrow, Modules.randomDefault.Next(0, arrowMax));
  432. }
  433. }
  434. }