SlamLostExistSafetyAreaSpecialState.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SlamLostExistSafetyAreaSpecialState : AbstractExistSafetyAreaSpecialState<SafetyAreaBase>
  5. {
  6. private float timer = 0f;
  7. public override void OnStateBreathe()
  8. {
  9. //Debug.LogError("SlamLostExistSafetyAreaSpecialState");
  10. reference.meshRenderer.enabled = false;
  11. if (SafetyAreaManager.Instance.isSettingSafetyArea || SafetyAreaManager.Instance.isDisableSafetyArea)
  12. {
  13. reference.outOfSafetyArea.SetActive(false);
  14. reference.nomapUI.SetActive(false);
  15. reference.slamLostUI.gameObject.SetActive(false);
  16. return;
  17. }
  18. timer += Time.deltaTime;
  19. if (timer > 0.5f)
  20. {
  21. reference.slamLostUI.gameObject.SetActive(true);
  22. }
  23. }
  24. public override void OnStateEnter(object data)
  25. {
  26. SafetyAreaManager.Instance.ExitSafetyAreaInvoke();
  27. SafetyAreaManager.Instance.OnDisableSafetyArea += OnDisableChange;
  28. API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnSlamPause);
  29. API_GSXR_Slam.GSXR_Reset_Slam_V2();
  30. //API_GSXR_Slam.GSXR_Reset_Slam();
  31. if (!SafetyAreaManager.Instance.isDisableSafetyArea)
  32. {
  33. API_GSXR_Slam.GSXR_StartSeeThrough();
  34. }
  35. timer = 0f;
  36. }
  37. public override void OnStateExit(object data)
  38. {
  39. API_GSXR_Slam.GSXR_Remove_SlamPauseCallback(OnSlamPause);
  40. API_GSXR_Slam.GSXR_StopSeeThrough();
  41. SafetyAreaManager.Instance.OnDisableSafetyArea -= OnDisableChange;
  42. //SafetyAreaManager.Instance.EnterSafetyAreaInvoke();
  43. }
  44. private void OnSlamPause(bool isPause)
  45. {
  46. if (!isPause && !SafetyAreaManager.Instance.isDisableSafetyArea)
  47. {
  48. API_GSXR_Slam.GSXR_StartSeeThrough();
  49. }
  50. }
  51. private void OnDisableChange(bool isDisable)
  52. {
  53. if (!isDisable)
  54. {
  55. API_GSXR_Slam.GSXR_StartSeeThrough();
  56. }
  57. else
  58. {
  59. API_GSXR_Slam.GSXR_StopSeeThrough();
  60. }
  61. }
  62. }