StoryE13P4.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections;
  3. using ExtensionMethods;
  4. using I2.Loc;
  5. using UnityEngine;
  6. public class StoryE13P4 : BaseBehaviour
  7. {
  8. private bool e13Finish
  9. {
  10. set
  11. {
  12. SaveStorage.Set("E13_Finish", value);
  13. }
  14. }
  15. private void Awake()
  16. {
  17. R.Camera.Controller.CameraResetPostionAfterSwitchScene();
  18. this.ucey = GameObject.FindGameObjectWithTag("Enemy");
  19. this.ucey.transform.position = this.uceyPos.position.SetZ(LayerManager.ZNum.MMiddleE(EnemyAttribute.RankType.Normal));
  20. }
  21. private void Start()
  22. {
  23. base.StartCoroutine(this.P4Coroutine());
  24. }
  25. private IEnumerator P4Coroutine()
  26. {
  27. this.ucey.GetComponent<AirRobotAction>().StopMoveToIdle();
  28. this.dao = Singleton<EnemyGenerator>.Instance.GenerateEnemy(EnemyType.斩轮式一型, new Vector2?(this.daoPos.position), false, true);
  29. this.pao = Singleton<EnemyGenerator>.Instance.GenerateEnemy(EnemyType.炮击式一型, new Vector2?(this.paoPos.position), false, true);
  30. this.dao.GetComponent<DaoAction>().ChangeFace(1);
  31. base.StartCoroutine(this.DaoMoe());
  32. base.StartCoroutine(this.PaoMoe());
  33. base.StartCoroutine(this.UceyLook());
  34. yield return R.Audio.PlayVoiceOver("e13t17", null, false);
  35. YieldInstruction voiceOver = R.Audio.PlayVoiceOver("e13t18", null, false);
  36. R.Camera.Controller.CameraZoom(R.Camera.Controller.MovableCamera.position, 5f, -5f);
  37. yield return new WaitForSeconds(5f);
  38. yield return voiceOver;
  39. this.dao.GetComponent<EnemyAttribute>().currentHp = 1;
  40. this.pao.GetComponent<EnemyAttribute>().currentHp = 1;
  41. this.ucey.GetComponent<EnemyAttribute>().currentHp = 1;
  42. R.Player.ActionController.ChangeState(PlayerAction.StateEnum.Idle);
  43. R.Player.ActionController.TurnRound(1);
  44. R.Player.ActionController.StartMove();
  45. while (this.playerStop.position.x - R.Player.Transform.position.x > 0f)
  46. {
  47. yield return null;
  48. }
  49. R.Player.ActionController.StopMove();
  50. R.Camera.Controller.Pivot = R.Player.Transform;
  51. yield return new WaitForSeconds(2f);
  52. R.Player.Transform.GetComponent<Claymore>().StartCharge(false);
  53. yield return new WaitForSeconds(4f);
  54. R.Player.Transform.GetComponent<Claymore>().ReleaseCharge(false);
  55. yield return new WaitForSeconds(3f);
  56. R.Ui.BlackScene.Alpha = 1f;
  57. R.Audio.StopBGM(true);
  58. R.Camera.Controller.CameraZoom(R.Camera.Controller.MovableCamera.position, 5f, 5f);
  59. yield return new WaitForSeconds(1f);
  60. yield return R.Audio.PlayVoiceOver("e13t19", null, false);
  61. yield return new WaitForSeconds(5f);
  62. R.Ui.BlackScene.Alpha = 0f;
  63. yield return R.Ui.Terminal.OpenWithAnim(null);
  64. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e13s2, 0.1f);
  65. this.e13Finish = true;
  66. R.Trophy.AwardTrophy(16);
  67. yield return SaveManager.ModifySaveData(delegate(GameData gameData)
  68. {
  69. if (gameData.ThisSaveValidStorage.ContainsKey("E13_Finish"))
  70. {
  71. gameData.ThisSaveValidStorage["E13_Finish"] = 1;
  72. }
  73. else
  74. {
  75. gameData.ThisSaveValidStorage.Add("E13_Finish", 1);
  76. }
  77. });
  78. yield return new WaitForSeconds(3f);
  79. yield return R.Ui.Terminal.CloseWithAnim();
  80. InputSetting.Resume(false);
  81. yield return R.Ui.LevelSelect.OpenWithAnim(true, true);
  82. yield break;
  83. }
  84. private IEnumerator DaoMoe()
  85. {
  86. while (this.dao != null && !this.dao.GetComponent<EnemyAttribute>().isDead)
  87. {
  88. int random = UnityEngine.Random.Range(0, 3);
  89. if (random != 0)
  90. {
  91. if (random == 1)
  92. {
  93. this.dao.GetComponent<DaoAction>().Idle3();
  94. }
  95. }
  96. else
  97. {
  98. this.dao.GetComponent<DaoAction>().Idle2();
  99. }
  100. yield return new WaitForSeconds(UnityEngine.Random.Range(3f, 4f));
  101. }
  102. yield break;
  103. }
  104. private IEnumerator PaoMoe()
  105. {
  106. while (this.pao != null && !this.pao.GetComponent<EnemyAttribute>().isDead)
  107. {
  108. int random = UnityEngine.Random.Range(0, 3);
  109. if (random != 0)
  110. {
  111. if (random == 1)
  112. {
  113. this.pao.GetComponent<DaoAction>().Idle3();
  114. }
  115. }
  116. else
  117. {
  118. this.pao.GetComponent<DaoAction>().Idle2();
  119. }
  120. yield return new WaitForSeconds(UnityEngine.Random.Range(3f, 4f));
  121. }
  122. yield break;
  123. }
  124. private IEnumerator UceyLook()
  125. {
  126. while (this.ucey != null && !this.ucey.GetComponent<EnemyAttribute>().isDead)
  127. {
  128. int random = UnityEngine.Random.Range(0, 2);
  129. if (random != 0)
  130. {
  131. if (random == 1)
  132. {
  133. this.ucey.GetComponent<AirRobotAction>().TurnRound(1);
  134. }
  135. }
  136. else
  137. {
  138. this.ucey.GetComponent<AirRobotAction>().TurnRound(-1);
  139. }
  140. yield return new WaitForSeconds(UnityEngine.Random.Range(3f, 4f));
  141. }
  142. yield break;
  143. }
  144. private GameObject ucey;
  145. private GameObject dao;
  146. private GameObject pao;
  147. [SerializeField]
  148. private Transform uceyPos;
  149. [SerializeField]
  150. private Transform daoPos;
  151. [SerializeField]
  152. private Transform paoPos;
  153. [SerializeField]
  154. private Transform playerStop;
  155. [SerializeField]
  156. private Transform _sceneSprites;
  157. }