25 lines
679 B
C#
25 lines
679 B
C#
using System.Collections.Generic;
|
|
using GameCore.ECS;
|
|
using Godot;
|
|
|
|
namespace CryptonymThunder.Code.Autoloads;
|
|
|
|
public partial class PresenterRegistry : Node
|
|
{
|
|
private readonly Dictionary<ulong, Entity> _instanceIdToEntity = new();
|
|
|
|
public void RegisterPresenter(Node presenterNode, Entity entity)
|
|
{
|
|
_instanceIdToEntity[presenterNode.GetInstanceId()] = entity;
|
|
}
|
|
|
|
public void UnregisterPresenter(Node presenterNode)
|
|
{
|
|
_instanceIdToEntity.Remove(presenterNode.GetInstanceId());
|
|
}
|
|
|
|
public bool TryGetEntity(ulong instanceId, out Entity entity)
|
|
{
|
|
return _instanceIdToEntity.TryGetValue(instanceId, out entity);
|
|
}
|
|
} |