using System.Collections; using System.Collections.Generic; using UnityEngine; public class OutOfExistSafetyAreaSpecialState : AbstractExistSafetyAreaSpecialState { private const float OFFLINE_MAP_CALL_TIME_SPAN = 0.5f; private float timer = 0f; public override void OnStateBreathe() { if (SafetyAreaManager.Instance.isSettingSafetyArea || SafetyAreaManager.Instance.isDisableSafetyArea) { reference.outOfSafetyArea.SetActive(false); reference.nomapUI.SetActive(false); reference.slamLostUI.gameObject.SetActive(false); reference.meshRenderer.enabled = !SafetyAreaManager.Instance.isDisableSafetyArea; return; } reference.outOfSafetyArea.SetActive(true); reference.meshRenderer.enabled = 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.NoMap); return; } } if (reference.distance > 10f) { reference.ChangeState(ExistSafetyAreaEnum.SlamLost); return; } if (reference.alpha < 1.1f) { 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.outOfSafetyArea.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(); } } }