StoryE2.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections;
  3. using ExtensionMethods;
  4. using I2.Loc;
  5. using UnityEngine;
  6. public class StoryE2 : BaseBehaviour
  7. {
  8. private static int JumpTimes
  9. {
  10. get
  11. {
  12. return RoundStorage.Get("E2_jumpTimes", 1);
  13. }
  14. set
  15. {
  16. RoundStorage.Set("E2_jumpTimes", value);
  17. }
  18. }
  19. private static bool HasJumped
  20. {
  21. get
  22. {
  23. return RoundStorage.Get("E2_hasJumped", true);
  24. }
  25. set
  26. {
  27. RoundStorage.Set("E2_hasJumped", value);
  28. }
  29. }
  30. private void Update()
  31. {
  32. if (StoryE2.HasJumped && Math.Abs(R.Player.Transform.position.x - this._point1.position.x) < 1f)
  33. {
  34. if (StoryE2.JumpTimes <= 3)
  35. {
  36. R.Audio.PlayVoiceOver("e2t" + (StoryE2.JumpTimes * 2 - 1), null, false);
  37. }
  38. StoryE2.HasJumped = false;
  39. }
  40. if (!StoryE2.HasJumped && Math.Abs(R.Player.Transform.position.y - this._cliffDead.position.y) < 1f)
  41. {
  42. StoryE2.HasJumped = true;
  43. InputSetting.Stop(false);
  44. SingletonMono<CameraController>.Instance.IsFollowPivot = false;
  45. switch (StoryE2.JumpTimes)
  46. {
  47. case 1:
  48. R.Audio.PlayVoiceOver("e2t2", delegate
  49. {
  50. R.Player.Transform.position = this._point1.position.SetZ(R.Player.Transform.position.z);
  51. SingletonMono<CameraController>.Instance.IsFollowPivot = true;
  52. InputSetting.Resume(false);
  53. }, false);
  54. break;
  55. case 2:
  56. R.Audio.PlayVoiceOver("e2t4", delegate
  57. {
  58. R.Player.Transform.position = this._point1.position.SetZ(R.Player.Transform.position.z);
  59. SingletonMono<CameraController>.Instance.IsFollowPivot = true;
  60. InputSetting.Resume(false);
  61. }, false);
  62. break;
  63. case 3:
  64. R.Audio.PlayVoiceOver("e2t6", delegate
  65. {
  66. R.Trophy.AwardTrophy(2);
  67. R.Player.Transform.position = this._point1.position.SetZ(R.Player.Transform.position.z);
  68. SingletonMono<CameraController>.Instance.IsFollowPivot = true;
  69. base.StartCoroutine(this.Sequence0());
  70. }, false);
  71. break;
  72. case 4:
  73. R.Audio.PlayVoiceOver("e2t8", delegate
  74. {
  75. base.StartCoroutine(this.Sequence1());
  76. }, false);
  77. break;
  78. default:
  79. R.Player.Transform.position = this._point1.position.SetZ(R.Player.Transform.position.z);
  80. break;
  81. }
  82. StoryE2.JumpTimes++;
  83. }
  84. }
  85. private IEnumerator Sequence0()
  86. {
  87. this._battleZoneGateL.Appear();
  88. this._battleZoneGateR.Appear();
  89. YieldInstruction voiceOver = R.Audio.PlayVoiceOver("e2t7", null, false);
  90. yield return new WaitForSeconds(2f);
  91. InputSetting.Resume(false);
  92. yield return voiceOver;
  93. this._machine.localPosition = this._machine.localPosition.SetY(1.62f);
  94. this._machine.localScale *= 1.5f;
  95. this._battleZoneGateL.DisAppear();
  96. this._battleZoneGateR.DisAppear();
  97. yield break;
  98. }
  99. private IEnumerator Sequence1()
  100. {
  101. Color color;
  102. ColorUtility.TryParseHtmlString("00c0ff", out color);
  103. yield return R.Ui.Terminal.OpenWithAnim(new Color?(color));
  104. YieldInstruction voiceOver = R.Audio.PlayVoiceOver("e2t9", null, false);
  105. yield return R.Ui.Terminal.PrintShellPrompt();
  106. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e2s1, 0.1f);
  107. yield return R.Ui.Terminal.PrintShellPrompt();
  108. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e2s2, 0.1f);
  109. yield return voiceOver;
  110. yield return R.Audio.PlayVoiceOver("e2t10", null, false);
  111. yield return R.Ui.Terminal.PrintShellPrompt();
  112. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e2s3, 0.1f);
  113. yield return R.Ui.Terminal.CloseWithAnim();
  114. yield return R.Audio.PlayVoiceOver("e2t11", null, false);
  115. R.Player.Rigidbody2D.gravityScale = 1f;
  116. this._gate.Enter(false);
  117. InputSetting.Resume(false);
  118. yield break;
  119. }
  120. [SerializeField]
  121. private Transform _point1;
  122. [SerializeField]
  123. private Transform _cliffDead;
  124. [SerializeField]
  125. private Transform _machine;
  126. [SerializeField]
  127. private SceneGate _gate;
  128. [SerializeField]
  129. private BattleZoneGate _battleZoneGateL;
  130. [SerializeField]
  131. private BattleZoneGate _battleZoneGateR;
  132. }