using System.Collections; using System.Collections.Generic; using UnityEngine; public class SlamLostExistSafetyAreaSpecialState : AbstractExistSafetyAreaSpecialState { private float timer = 0f; public override void OnStateBreathe() { //Debug.LogError("SlamLostExistSafetyAreaSpecialState"); 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; } timer += Time.deltaTime; if (timer > 0.5f) { reference.slamLostUI.gameObject.SetActive(true); } } public override void OnStateEnter(object data) { SafetyAreaManager.Instance.ExitSafetyAreaInvoke(); SafetyAreaManager.Instance.OnDisableSafetyArea += OnDisableChange; API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnSlamPause); API_GSXR_Slam.GSXR_Reset_Slam_V2(); //API_GSXR_Slam.GSXR_Reset_Slam(); if (!SafetyAreaManager.Instance.isDisableSafetyArea) { API_GSXR_Slam.GSXR_StartSeeThrough(); } timer = 0f; } public override void OnStateExit(object data) { API_GSXR_Slam.GSXR_Remove_SlamPauseCallback(OnSlamPause); API_GSXR_Slam.GSXR_StopSeeThrough(); SafetyAreaManager.Instance.OnDisableSafetyArea -= OnDisableChange; //SafetyAreaManager.Instance.EnterSafetyAreaInvoke(); } 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(); } } }