StoryE4.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. [RequireComponent(typeof(PolygonCollider2D))]
  5. public class StoryE4 : BaseBehaviour
  6. {
  7. private void Awake()
  8. {
  9. this._boxCollider2D = base.GetComponent<PolygonCollider2D>();
  10. this._boxCollider2D.isTrigger = true;
  11. }
  12. public void OnTriggerEnter2D(Collider2D collision)
  13. {
  14. if (collision.CompareTag("Player"))
  15. {
  16. int jumpTimes = this._jumpTimes;
  17. if (jumpTimes != 1)
  18. {
  19. if (jumpTimes != 2)
  20. {
  21. if (jumpTimes == 3)
  22. {
  23. this._jumpTimes++;
  24. base.StartCoroutine(this.Sequence0());
  25. }
  26. }
  27. else
  28. {
  29. this._jumpTimes++;
  30. R.Audio.PlayVoiceOver("e4t2", null, false);
  31. }
  32. }
  33. else
  34. {
  35. this._jumpTimes++;
  36. R.Audio.PlayVoiceOver("e4t1", null, false);
  37. }
  38. }
  39. }
  40. private IEnumerator Sequence0()
  41. {
  42. R.Audio.PlayVoiceOver("e4t3", null, false);
  43. CameraFilterUtils.Create<CameraFilterPack_FX_Drunk>(null);
  44. R.Trophy.AwardTrophy(4);
  45. yield return new WaitForSeconds(10f);
  46. CameraFilterUtils.Remove<CameraFilterPack_FX_Drunk>(null);
  47. yield break;
  48. }
  49. private void OnDestroy()
  50. {
  51. CameraFilterUtils.Remove<CameraFilterPack_FX_Drunk>(null);
  52. }
  53. private PolygonCollider2D _boxCollider2D;
  54. private int _jumpTimes = 1;
  55. }