StoryE8P2.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections;
  3. using DG.Tweening;
  4. using I2.Loc;
  5. using UnityEngine;
  6. [RequireComponent(typeof(BoxCollider2D))]
  7. public class StoryE8P2 : BaseBehaviour
  8. {
  9. private void Start()
  10. {
  11. base.GetComponent<BoxCollider2D>().isTrigger = true;
  12. }
  13. private void OnDestroy()
  14. {
  15. UnityEngine.Object.Destroy(this._videoRenderer);
  16. if (this._playVideo != null)
  17. {
  18. this._playVideo.Dispose();
  19. }
  20. }
  21. public void OnTriggerEnter2D(Collider2D collision)
  22. {
  23. if (this.isFirst && collision.CompareTag("Player"))
  24. {
  25. this.isFirst = false;
  26. base.StartCoroutine(this.Sequence0());
  27. }
  28. }
  29. private IEnumerator Sequence0()
  30. {
  31. this._textMesh.text = ScriptLocalization.Story.e8s2;
  32. this._textMesh.gameObject.SetActive(true);
  33. yield return R.Audio.PlayVoiceOver("e8t4", null, false);
  34. yield return R.Audio.PlayVoiceOver("e8t5", null, false);
  35. this._textMesh.gameObject.SetActive(false);
  36. this._background.gameObject.SetActive(true);
  37. this._background.color = Color.clear;
  38. this._background.DOColor(Color.white, 1f);
  39. yield return R.Audio.PlayVoiceOver("e8t6", null, false);
  40. this._background.DOColor(Color.clear, 1f);
  41. this._background.gameObject.SetActive(false);
  42. this._videoRenderer.gameObject.SetActive(true);
  43. this._playVideo = PlayVideo.CreateVideo(this._videoRenderer);
  44. Coroutine coroutine = this._playVideo.Play("Movies/ps4/E8", "video0.mp4", false);
  45. yield return R.Audio.PlayVoiceOver("e8t7", null, false);
  46. yield return coroutine;
  47. this._videoRenderer.gameObject.SetActive(false);
  48. this._playVideo.Dispose();
  49. this._cross.gameObject.SetActive(true);
  50. R.Audio.PlayEffect(145, null);
  51. yield return R.Audio.PlayVoiceOver("e8t8", null, false);
  52. this._cross.gameObject.SetActive(false);
  53. this._animation.gameObject.SetActive(true);
  54. this._animation.Play();
  55. yield return new WaitForSeconds(this._animation.clip.length);
  56. this._animation.gameObject.SetActive(false);
  57. this._videoRenderer.gameObject.SetActive(true);
  58. this._playVideo = PlayVideo.CreateVideo(this._videoRenderer);
  59. coroutine = this._playVideo.Play("Movies/ps4/E8", "video1.mp4", false);
  60. yield return R.Audio.PlayVoiceOver("e8t9", null, false);
  61. yield return coroutine;
  62. this._videoRenderer.gameObject.SetActive(false);
  63. this._playVideo.Dispose();
  64. this._cross.gameObject.SetActive(true);
  65. R.Audio.PlayEffect(145, null);
  66. yield return R.Audio.PlayVoiceOver("e8t10", null, false);
  67. this._cross.gameObject.SetActive(false);
  68. this._animation.gameObject.SetActive(true);
  69. this._animation.Play();
  70. yield return new WaitForSeconds(this._animation.clip.length);
  71. this._animation.gameObject.SetActive(false);
  72. this._textMesh.text = ScriptLocalization.Story.e8s3;
  73. this._textMesh.gameObject.SetActive(true);
  74. yield return R.Audio.PlayVoiceOver("e8t11", null, false);
  75. this._textMesh.gameObject.SetActive(false);
  76. this._fatMan.gameObject.SetActive(true);
  77. this._thinMan.gameObject.SetActive(true);
  78. this._thinMan.color = Color.clear;
  79. this._fatMan.DOColor(Color.clear, 5f);
  80. this._thinMan.DOColor(Color.white, 5f);
  81. yield return R.Audio.PlayVoiceOver("e8t12", null, false);
  82. this._fatMan.gameObject.SetActive(false);
  83. this._thinMan.gameObject.SetActive(false);
  84. for (int i = 0; i < this._Stars.Length; i++)
  85. {
  86. this._Stars[i].gameObject.SetActive(true);
  87. this._Stars[i].color = Color.clear;
  88. R.Audio.PlayEffect(459, null);
  89. yield return this._Stars[i].DOColor(Color.white, 0.5f).WaitForCompletion();
  90. }
  91. yield return R.Audio.PlayVoiceOver("e8t13", null, false);
  92. for (int j = 0; j < this._Stars.Length; j++)
  93. {
  94. this._Stars[j].DOColor(Color.clear, 0.5f);
  95. }
  96. yield return new WaitForSeconds(0.5f);
  97. this._ubisoftIcon.SetActive(true);
  98. yield return R.Audio.PlayVoiceOver("e8t14", null, false);
  99. yield return R.Audio.PlayVoiceOver("e8t15", null, false);
  100. this._ubisoftIcon.SetActive(false);
  101. R.Ui.BlackScene.FadeBlack(0f, false);
  102. yield return R.Audio.PlayVoiceOver("e8t16", null, false);
  103. yield return new WaitForSeconds(5f);
  104. R.Ui.BlackScene.FadeTransparent(0.3f, false);
  105. yield return R.Ui.Terminal.OpenWithAnim(null);
  106. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e8s4, 0.1f);
  107. R.Trophy.AwardTrophy(10);
  108. yield return new WaitForSeconds(3f);
  109. yield return R.Ui.Terminal.CloseWithAnim();
  110. R.Ui.ShowUI(false);
  111. R.Ui.LevelSelect.OpenWithAnim(true, true);
  112. yield break;
  113. }
  114. [SerializeField]
  115. private Renderer _videoRenderer;
  116. [SerializeField]
  117. private TextMesh _textMesh;
  118. [SerializeField]
  119. private SpriteRenderer _background;
  120. [SerializeField]
  121. private TextMesh _cross;
  122. [SerializeField]
  123. private Animation _animation;
  124. [SerializeField]
  125. private SpriteRenderer _fatMan;
  126. [SerializeField]
  127. private SpriteRenderer _thinMan;
  128. [SerializeField]
  129. private SpriteRenderer[] _Stars;
  130. [SerializeField]
  131. private GameObject _ubisoftIcon;
  132. private PlayVideo _playVideo;
  133. private bool isFirst = true;
  134. }