This commit is contained in:
Janis
2022-05-29 19:55:21 +02:00
parent 69df1ae43a
commit 2241ada340
94 changed files with 14544 additions and 11 deletions

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using UnityEngine;
public abstract class Dictionary<TEntryType> : MonoBehaviour
{
public List<TEntryType> entries = new List<TEntryType>();
public abstract TEntryType GetEntryById(string id);
public static Dictionary<TEntryType> instance { get; private set; }
protected virtual void Awake()
{
if (instance != null)
{
Destroy(gameObject);
return;
}
else
{
instance = this;
}
}
public void Register(TEntryType entry)
{
entries.Add(entry);
}
public void Unregister(TEntryType entry)
{
entries.Remove(entry);
}
}