public static void Load(List <TextNode> nodes) { foreach (var node in nodes) { var name = node.Key; var parts = new PartInfo[node.Children.Count]; var currentPartCounts = new Dictionary <string, int>(); for (int i = 0; i < parts.Length; i++) { var child = node.Children[i]; if (!currentPartCounts.ContainsKey(child.Key)) { currentPartCounts[child.Key] = 0; } parts[i] = TypeLoader.GetPart(currentPartCounts[child.Key]++, child); } Types.Add(name, new ActorType(parts)); } }