Files
Studio/Assets/Scripts/LocationMapper.cs

34 lines
729 B
C#
Raw Normal View History

2025-03-20 10:33:24 +09:00
using System.Collections.Generic;
using UnityEngine;
using XRLib;
2025-05-20 16:25:58 +09:00
namespace Studio.VirtualFactory
2025-03-20 10:33:24 +09:00
{
public class LocationMapper : MonoBehaviour, ISingle
{
public Dictionary<string, TwinObject> locationMap = new();
public void Regist(TwinObject to)
{
2025-03-20 15:11:44 +09:00
locationMap.Add(to.entity.id, to);
2025-03-20 10:33:24 +09:00
}
public void Unregist(TwinObject to)
{
2025-03-20 15:11:44 +09:00
locationMap.Remove(to.entity.id);
2025-03-20 10:33:24 +09:00
}
public void Unregist(string id)
{
locationMap.Remove(id);
}
public TwinObject Find(string id)
{
if (locationMap.TryGetValue(id, out var to))
return to;
return null;
}
}
}