34 lines
726 B
C#
34 lines
726 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using XRLib;
|
|
|
|
namespace XED.VirtualFactory
|
|
{
|
|
public class LocationMapper : MonoBehaviour, ISingle
|
|
{
|
|
public Dictionary<string, TwinObject> locationMap = new();
|
|
|
|
public void Regist(TwinObject to)
|
|
{
|
|
locationMap.Add(to.entity.id, to);
|
|
}
|
|
|
|
public void Unregist(TwinObject to)
|
|
{
|
|
locationMap.Remove(to.entity.id);
|
|
}
|
|
|
|
public void Unregist(string id)
|
|
{
|
|
locationMap.Remove(id);
|
|
}
|
|
|
|
public TwinObject Find(string id)
|
|
{
|
|
if (locationMap.TryGetValue(id, out var to))
|
|
return to;
|
|
return null;
|
|
}
|
|
}
|
|
}
|