Exemplo n.º 1
0
        /// <summary>
        /// Given some input EdgeCollection, iterates through its edges and adds 'valid' ones to a new
        /// collection, which is then returned.
        /// Validity is determined through the _IsLedgeValid function.
        /// </summary>
        /// <param name="ledgeColl"></param>
        /// <param name="preTileMap"></param>
        /// <param name="superTileMap"></param>
        /// <returns></returns>
        private static EdgeCollection <TileEdge> _BuildHoleGroupValidLedges(EdgeCollection <TileEdge> ledgeColl, TileMap preTileMap, TileMap superTileMap)
        {
            var validLedges = new EdgeCollection <TileEdge>();

            foreach (TileEdge ledge in ledgeColl)
            {
                if (_IsLedgeValid(ledge, preTileMap, superTileMap))
                {
                    TileEdge superimposedLedge = ledge.GetShiftedByN(SHIFT_DIST);
                    if (!validLedges.HasEdgePoints(superimposedLedge))
                    {
                        validLedges.Add(superimposedLedge);
                    }
                }
            }
            return(validLedges);
        }