using System; using Gameplay.Common; using PhxhSDK; using UnityEngine; using Object = UnityEngine.Object; namespace Gameplay.Area.Ready { public class ReadyAreaPoint { public int cellIndex = -1; public GameObject noticeObj; public string prefabPath; public ReadyAreaPoint(string prefabPath) { this.prefabPath = prefabPath; } public void SetIndex(int setIndex) { if (cellIndex == setIndex) { noticeObj.SetActive(true); } else { cellIndex = setIndex; if (noticeObj == null) { var sampleObj = AssetManager.Instance.GetPreLoadResult(prefabPath); if (sampleObj == null) { throw new Exception("ReadyAreaPoint 资源尚未加载"); } var parent = AreaManager.instance.readyAreaManager.rootObj.transform; noticeObj = Object.Instantiate(sampleObj, parent); } else { noticeObj.SetActive(true); } var worldPos = AreaManager.instance.GetWorldPosByIndex(cellIndex); noticeObj.transform.position = worldPos; } } public void Hide() { noticeObj.SetActive(false); } } }