add: Item Manager
This commit is contained in:
@@ -32,6 +32,39 @@ public class PoloniumRegistry
|
||||
// ReSharper disable once CollectionNeverQueried.Global
|
||||
[RegistryPassThrough(true)]
|
||||
public HashSet<ITimeConsumer> TimeConsumers { get; } = new();
|
||||
|
||||
|
||||
public static class Action<TAction>
|
||||
where TAction : AgentAction
|
||||
{
|
||||
// ReSharper disable once StaticMemberInGenericType
|
||||
public static string Name { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public static class SkinRegistry<TSkin>
|
||||
where TSkin : Polonium.SkinManagers.Skin
|
||||
{
|
||||
// ReSharper disable once StaticMemberInGenericType
|
||||
public static Color[] PaletteRoots { get; set; }
|
||||
// ReSharper disable once StaticMemberInGenericType
|
||||
public static Dictionary<Color, Color[]> PaletteMap { get; set; }
|
||||
}
|
||||
|
||||
public static class Asset<TAsset>
|
||||
where TAsset : Node
|
||||
{
|
||||
private static readonly Queue<TAsset> Pool = new();
|
||||
public static PackedScene Scene { get; set; }
|
||||
private static TAsset Instance => Scene.Instantiate<TAsset>();
|
||||
public static TAsset Get() => Pool.Count > 0 ? Pool.Dequeue() : Instance;
|
||||
|
||||
public static void Return(TAsset asset)
|
||||
{
|
||||
if (Pool.Count < 10)
|
||||
Pool.Enqueue(asset);
|
||||
else
|
||||
asset.QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user