StoryE11P2.cs 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(BoxCollider2D))]
  4. public class StoryE11P2 : BaseBehaviour
  5. {
  6. private int _times
  7. {
  8. get
  9. {
  10. return RoundStorage.Get("E11_p2_times", 1);
  11. }
  12. set
  13. {
  14. RoundStorage.Set("E11_p2_times", value);
  15. }
  16. }
  17. public void OnTriggerEnter2D(Collider2D collision)
  18. {
  19. if (!collision.CompareTag("Player"))
  20. {
  21. return;
  22. }
  23. switch (this._times)
  24. {
  25. case 1:
  26. R.Audio.PlayVoiceOver("e11t2", null, false);
  27. R.Player.SetPosition(this._point1.position);
  28. break;
  29. case 2:
  30. R.Audio.PlayVoiceOver("e11t3", null, false);
  31. R.Player.SetPosition(this._point1.position);
  32. break;
  33. case 3:
  34. R.Audio.PlayVoiceOver("e11t4", null, false);
  35. R.Player.SetPosition(this._point1.position);
  36. break;
  37. case 4:
  38. R.Audio.PlayVoiceOver("e11t5", null, false);
  39. break;
  40. }
  41. this._times++;
  42. }
  43. [SerializeField]
  44. private Transform _point1;
  45. }