Animations improved

This commit is contained in:
Фёдор Веселов 2024-10-07 00:05:10 +05:00
commit ad18793543
35 changed files with 430 additions and 465 deletions

View file

@ -21,9 +21,37 @@ public partial class PoolContainer : Node
public static PoolContainer Instance {get; private set;}
public Dictionary<Vector2, IEntity>[] EntityField = { new Dictionary<Vector2, IEntity>(), new Dictionary<Vector2, IEntity>(), new Dictionary<Vector2, IEntity>() };
public Dictionary<Vector2, IEntity>[] EntityField = { new(), new(), new() };
public override void _Ready()
{
Instance = this;
}
public bool TryGetEntity(Vector2 key, out IEntity result, int layer = 1)
{
if (EntityField[layer].ContainsKey(key))
{
result = EntityField[layer][key];
}
else
{
result = null;
}
return EntityField[layer].ContainsKey(key)
&& EntityField[layer][key] != null;
}
public bool TryGetEntity<T>(Vector2 key, out T result, int layer = 1) where T : class
{
if (EntityField[layer].ContainsKey(key))
{
result = EntityField[layer][key] as T;
}
else
{
result = null;
}
return EntityField[layer].ContainsKey(key)
&& EntityField[layer][key] != null
&& result != null;
}
}