123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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<GroundHeightStep>(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>();
- 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;
- }
- }
|