コード例 #1
0
        private List <RoomTemplateInstanceGrid2D> GetPossibleShapesForNode(ILayout <TNode, TConfiguration> layout, TNode node, RoomTemplateRepeatMode?modeOverride)
        {
            var shapesForNode = new HashSet <IntAlias <PolygonGrid2D> >(shapesForNodes[node].Select(x => x.Shape));

            foreach (var configuration in layout.GetAllConfigurations())
            {
                if (configuration.Room.Equals(node))
                {
                    continue;
                }

                var polygon          = intAliasMapping[configuration.RoomShape];
                var roomTemplateInfo = roomTemplateInstanceInfo[polygon.Alias];
                var repeatMode       = modeOverride ?? roomTemplateInfo.RoomTemplate.RepeatMode ?? repeatModeDefault;

                if (repeatMode == RoomTemplateRepeatMode.NoRepeat || (repeatMode == RoomTemplateRepeatMode.NoImmediate && graphWithoutCorridors.HasEdge(node, configuration.Room)))
                {
                    foreach (var alias in roomTemplateInfo.Aliases)
                    {
                        shapesForNode.Remove(alias);
                    }
                }
            }

            return(shapesForNode.Select(x => intAliasMapping.GetByValue(x)).ToList());
        }
コード例 #2
0
        private List <IntAlias <PolygonGrid2D> > GetPossibleShapesForNode(ILayout <TNode, TConfiguration> layout, TNode node, RoomTemplateRepeatMode?modeOverride)
        {
            var shapesForNode = new HashSet <IntAlias <PolygonGrid2D> >(configurationSpaces.GetShapesForNode(node));

            foreach (var configuration in layout.GetAllConfigurations())
            {
                if (configuration.Node.Equals(node))
                {
                    continue;
                }

                var roomTemplateInfo = roomTemplateInstanceInfo[configuration.ShapeContainer.Alias];
                var repeatMode       = modeOverride ?? roomTemplateInfo.RoomTemplate.RoomTemplateRepeatMode;

                if (repeatMode == RoomTemplateRepeatMode.NoRepeat || (repeatMode == RoomTemplateRepeatMode.NoImmediate && stageOneGraph.HasEdge(node, configuration.Node)))
                {
                    foreach (var alias in roomTemplateInfo.Aliases)
                    {
                        shapesForNode.Remove(alias);
                    }
                }
            }

            return(shapesForNode.ToList());
        }