StoryE9P4.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using UnityEngine;
  3. public class StoryE9P4 : BaseBehaviour
  4. {
  5. private bool IsE9P4FirstBossNotDie
  6. {
  7. get
  8. {
  9. return RoundStorage.Get("E9_p4FirstBossNotDie", true);
  10. }
  11. set
  12. {
  13. RoundStorage.Set("E9_p4FirstBossNotDie", value);
  14. }
  15. }
  16. private bool IsE9BossDie
  17. {
  18. get
  19. {
  20. return RoundStorage.Get("E9_BossDie", false);
  21. }
  22. }
  23. private void Start()
  24. {
  25. if (!this.IsE9P4FirstBossNotDie || this.IsE9BossDie)
  26. {
  27. this._e9Anim.Play("StoryE9Close");
  28. }
  29. }
  30. public void OnTriggerEnter2D(Collider2D collision)
  31. {
  32. if (!collision.CompareTag("Player"))
  33. {
  34. return;
  35. }
  36. if (this._e9Anim == null)
  37. {
  38. Log.Error("E9Anim为空");
  39. return;
  40. }
  41. if (this.IsE9P4FirstBossNotDie && !this.IsE9BossDie)
  42. {
  43. this.IsE9P4FirstBossNotDie = false;
  44. this.DoorClose();
  45. }
  46. if (this._isE9P4FirstBossDie && this.IsE9BossDie)
  47. {
  48. this._isE9P4FirstBossDie = false;
  49. this.DoorOpen();
  50. }
  51. }
  52. private void DoorClose()
  53. {
  54. this._e9Anim.Play("StoryE9Close");
  55. R.Audio.PlayVoiceOver("e9t6", null, false);
  56. }
  57. private void DoorOpen()
  58. {
  59. this._e9Anim.Play("StoryE9Open");
  60. R.Audio.PlayVoiceOver("e9t7", null, false);
  61. }
  62. private bool _isE9P4FirstBossDie = true;
  63. [SerializeField]
  64. private Animator _e9Anim;
  65. [SerializeField]
  66. private SceneGate _gate;
  67. }