40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using PhxhSDK;
|
|
using UnityEngine;
|
|
|
|
namespace Gameplay.Area
|
|
{
|
|
public class BuffCellNotice
|
|
{
|
|
public int cellIndex;
|
|
public string loadPath;
|
|
private GameObject _noticeObj;
|
|
|
|
public async void CreateView(Transform parent)
|
|
{
|
|
var sampleObj = await AssetManager.Instance.LoadAssetAsync<GameObject>(loadPath);
|
|
if (sampleObj == null)
|
|
{
|
|
return;
|
|
}
|
|
_noticeObj = Object.Instantiate(sampleObj, parent);
|
|
var worldPos = AreaManager.instance.GetWorldPosByIndex(cellIndex);
|
|
_noticeObj.transform.position = worldPos;
|
|
SetActive(false);
|
|
}
|
|
|
|
public void SetActive(bool setValue)
|
|
{
|
|
if (_noticeObj == null) return;
|
|
_noticeObj.SetActive(setValue);
|
|
}
|
|
|
|
|
|
public void Dispose()
|
|
{
|
|
Object.Destroy(_noticeObj);
|
|
_noticeObj = null;
|
|
AssetManager.Instance.Unload(loadPath);
|
|
}
|
|
}
|
|
}
|