using SC.XR.Unity; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class SafetyAreaMono : MonoBehaviour { public Material safetyPlaneMat; public Material safetyPlaneConfirmedMat; public Material safetyPlaneHoverMat; public Material areaConfirmMat; public Material areaNormalMat; public GroundHeightUI groundHeightUI; public PlayAreaWaitingDrawUI playAreaWaitingDrawUI; public PlayAreaNotEnoughUI playAreaNotEnoughUI; public PlayAreaOKUI playAreaOKUI; public StationaryAreaUI stationaryAreaUI; public ConfirmPlayAreaUI confirmPlayAreaUI; public SafetyGreyCameraUI safetyGreyCameraUI; [HideInInspector] public SafetyPlaneMono safetyPlaneMono; private GameObject safetyPlaneObject; //[HideInInspector] //public StationaryAreaMono stationaryAreaMono; //private GameObject stationaryAreaObject; //[HideInInspector] //public PlayAreaMono playAreaMono; //private GameObject playAreaObject; private GroundHeightStep groundHeightStep; private void Awake() { DontDestroyOnLoad(this.gameObject); } public void Init(object data) { if (groundHeightStep == null) { groundHeightStep = SafetyAreaManager.Instance.GetStep(SafetyAreaStepEnum.GroundHeight); } SafetyAreaManager.Instance.ChangeStep(SafetyAreaStepEnum.GroundHeight, data); } public void Release() { } //创建平面 public void CreateSafetyPlane() { Debug.LogError("CreateSafetyPlane"); if (safetyPlaneMono == null) { safetyPlaneObject = new GameObject("SafetyPlane"); safetyPlaneMono = safetyPlaneObject.AddComponent(); safetyPlaneMono.Init(); safetyPlaneMono.DisableRenderer(); } } public void EnablePlaneMeshRenderer() { if (safetyPlaneMono != null) { safetyPlaneMono.EnableRenderer(); } } //销毁平面 public void DestroySafetyPlane() { if (safetyPlaneObject != null) { GameObject.Destroy(safetyPlaneObject); } safetyPlaneObject = null; safetyPlaneMono = null; } }