47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
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 void SetIndex(int setIndex)
|
|
{
|
|
if (cellIndex == setIndex)
|
|
{
|
|
noticeObj.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
cellIndex = setIndex;
|
|
if (noticeObj == null)
|
|
{
|
|
var sampleObj = AssetManager.Instance.GetPreLoadResult<GameObject>(PathDefine.ReadyArea.READY_AREA_POINT);
|
|
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.GetCellPosByIndex(cellIndex);
|
|
noticeObj.transform.position = worldPos;
|
|
}
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
noticeObj.SetActive(false);
|
|
}
|
|
}
|
|
}
|