NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Area/MoveArea/BuffCellNotice.cs

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.GetCellPosByIndex(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);
}
}
}