Ejemplo n.º 1
0
        private static TileRect GetCornerRect(LevelCorner corner, int width, int height, int size)
        {
            int minX, maxX, minY, maxY;

            if (corner.IsSouth())
            {
                minY = 0;
                maxY = size - 1;
            }
            else
            {
                minY = height - size;
                maxY = height - 1;
            }

            if (corner.IsEast())
            {
                minX = 0;
                maxX = size - 1;
            }
            else
            {
                minX = width - size;
                maxX = width - 1;
            }

            var rect = new TileRect(minX, minY, maxX, maxY);

            rect.Clamp(width, height);
            return(rect);
        }
Ejemplo n.º 2
0
        public TilePosition GenerateExitPosition(int width, int height, TilePosition entryPosition)
        {
            var minX      = entryPosition.X - _minDistanceFromExitToEntry;
            var minY      = entryPosition.Y - _minDistanceFromExitToEntry;
            var maxX      = entryPosition.X + _minDistanceFromExitToEntry;
            var maxY      = entryPosition.Y + _minDistanceFromExitToEntry;
            var entryRect = new TileRect(minX, minY, maxX, maxY);

            entryRect.Clamp(width, height);

            return(GetRandomTileExcludingRect(width, height, entryRect));
        }