using System.Collections.Generic; namespace MoonTools.ECS { public class TemplateStorage { private int nextID = 0; private Dictionary> TemplateToComponentTypeIndices = new Dictionary>(); public Template Create() { TemplateToComponentTypeIndices.Add(nextID, new HashSet()); return new Template(NextID()); } public bool SetComponent(int templateID, int componentTypeIndex) { return TemplateToComponentTypeIndices[templateID].Add(componentTypeIndex); } public HashSet ComponentTypeIndices(int templateID) { return TemplateToComponentTypeIndices[templateID]; } private int NextID() { var id = nextID; nextID += 1; return id; } } }