private AbstractDungeonStructure(AbstractDungeonElement startElement, StructureMetaData structureMetaData)
        {
            StartElement      = startElement;
            StructureMetaData = structureMetaData;

            StructureMetaData.MaxOptionalEndpointNum = RecalculateMaxEndpointNum(startElement);
            StructureMetaData.MinOptionalEndpointNum = RecalculateMinEndpointNum(startElement);
        }
        private uint RecalculateMaxEndpointNum(AbstractDungeonElement element)
        {
            uint res = 0;

            if (element.ElementMetaData.OptionalEndpoint)
            {
                res++;
            }
            return(element.SubElements.Aggregate(0u, (sum, e) => sum + RecalculateMaxEndpointNum(e)) + res);
        }
 public AbstractDungeonStructureBuilderFinisher(AbstractDungeonStructure newInstance, AbstractDungeonElement startElement)
 {
     this.newInstance = newInstance;
     this.newInstance.StartElement = startElement;
 }
 public NestedDungeonElementBuilder AddSubElement(AbstractDungeonElement element) => this.Also(x => _element.SubElements.Add(element));
 public AbstractDungeonStructureBuilderFinisher SetStartElement(AbstractDungeonElement startElement) => new AbstractDungeonStructureBuilderFinisher(newInstance, startElement);