mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
init: add project
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace _Project.Develop.Runtime.Entities
|
||||
{
|
||||
public class CollidersRegistryService
|
||||
{
|
||||
private readonly Dictionary<Collider, Entity> _colliderToEntity = new();
|
||||
|
||||
public void Register(Collider collider, Entity entity)
|
||||
{
|
||||
_colliderToEntity.Add(collider, entity);
|
||||
}
|
||||
|
||||
public void Unregister(Collider collider)
|
||||
{
|
||||
_colliderToEntity.Remove(collider);
|
||||
}
|
||||
|
||||
public Entity GetBy(Collider collider)
|
||||
{
|
||||
if (_colliderToEntity.TryGetValue(collider, out Entity entity))
|
||||
return entity;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user