1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class NoMapExistSafetyAreaSpecialState : AbstractExistSafetyAreaSpecialState<SafetyAreaBase>
- {
- private const float OFFLINE_MAP_CALL_TIME_SPAN = 0.5f;
- private float timer = 0f;
- public override void OnStateBreathe()
- {
- //Debug.LogError("NoMapExistSafetyAreaSpecialState");
- reference.meshRenderer.enabled = false;
- if (SafetyAreaManager.Instance.isSettingSafetyArea || SafetyAreaManager.Instance.isDisableSafetyArea)
- {
- reference.outOfSafetyArea.SetActive(false);
- reference.nomapUI.SetActive(false);
- reference.slamLostUI.gameObject.SetActive(false);
- return;
- }
- reference.nomapUI.SetActive(true);
- timer += Time.deltaTime;
- if (timer >= OFFLINE_MAP_CALL_TIME_SPAN)
- {
- timer = 0f;
- int currentRelocState = API_GSXR_Slam.GSXR_Get_OfflineMapRelocState();
- if (currentRelocState != 0)
- {
- reference.ChangeState(ExistSafetyAreaEnum.Normal);
- return;
- }
- }
- }
- public override void OnStateEnter(object data)
- {
- SafetyAreaManager.Instance.ExitSafetyAreaInvoke();//OnEnterSafetyArea?.Invoke();
- SafetyAreaManager.Instance.OnDisableSafetyArea += OnDisableChange;
- if (!SafetyAreaManager.Instance.isDisableSafetyArea)
- {
- API_GSXR_Slam.GSXR_StartSeeThrough();
- }
- API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnSlamPause);
- }
- public override void OnStateExit(object data)
- {
- API_GSXR_Slam.GSXR_Remove_SlamPauseCallback(OnSlamPause);
- API_GSXR_Slam.GSXR_StopSeeThrough();
- reference.nomapUI.SetActive(false);
- SafetyAreaManager.Instance.OnDisableSafetyArea -= OnDisableChange;
- //SafetyAreaManager.Instance.EnterSafetyAreaInvoke();//OnExitSafetyArea?.Invoke();
- }
- private void OnSlamPause(bool isPause)
- {
- if (!isPause && !SafetyAreaManager.Instance.isDisableSafetyArea)
- {
- API_GSXR_Slam.GSXR_StartSeeThrough();
- }
- }
- private void OnDisableChange(bool isDisable)
- {
- if (!isDisable)
- {
- API_GSXR_Slam.GSXR_StartSeeThrough();
- }
- else
- {
- API_GSXR_Slam.GSXR_StopSeeThrough();
- }
- }
- }
|