Add Hunter NPC and Teleporter features with associated prefabs and effects

This commit is contained in:
2025-12-13 00:01:29 +01:00
parent c0fb207768
commit d8b0583fac
32 changed files with 823 additions and 217 deletions

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
using UnityEngine;
namespace Infrastructure.Unity
{
public class TilePool
{
private readonly TileViewAdapter _prefab;
private readonly Transform _parent;
private readonly Stack<TileViewAdapter> _pool = new();
public TilePool(TileViewAdapter prefab, Transform parent)
{
_prefab = prefab;
_parent = parent;
}
public TileViewAdapter Get()
{
if (_pool.Count > 0)
{
var item = _pool.Pop();
item.gameObject.SetActive(true);
return item;
}
return Object.Instantiate(_prefab, _parent);
}
public void Return(TileViewAdapter item)
{
item.gameObject.SetActive(false);
_pool.Push(item);
}
}
}