Beispiel #1
0
 private void ComputeRegions(TileSignature.Region[,] regions, Data.Layout.Outdoor layout, int totalSize)
 {
     for (int col = 0; col < totalSize; col++)
     {
         for (int row = 0; row < totalSize; row++)
         {
             regions[col, row] = GetRegionInLayout(layout, col, row);
         }
     }
 }
Beispiel #2
0
        private TileSignature.Region GetRegionInLayout(Data.Layout.Outdoor layout, int x, int y)
        {
            TileSignature.Region region = new TileSignature.Region(layout.BaselineEnvironment, 0);
            if (x < BoundarySize || y < BoundarySize || x > Size + BoundarySize || y > Size + BoundarySize)
            {
                return(region);
            }

            Vector2 coordinate = new Vector2(x - BoundarySize, y - BoundarySize);

            coordinate /= Size;
            coordinate *= layout.Size;
            coordinate += new Vector2(0.5f, 0.5f) + layout.Center - layout.Size * 0.5f;

            foreach (var environment in environments)
            {
                if (environment.GetRegion(coordinate, region, out region))
                {
                    return(region);
                }
            }

            return(region);
        }