Пример #1
0
        public LocationShapeBorderSelector(LocationsMap locationsMap, bool[,] locationShapeMap, List <Vector2Int> locationShapeBlocksPos)
        {
            this.locationsMap     = locationsMap;
            this.locationShapeMap = locationShapeMap;

            SelectBorder(locationShapeBlocksPos);
        }
 public LocationGenerator(TilesMap tilesMap, LocationsMap locationsMap, ObjectsMap objectsMap, Random random)
 {
     this.tilesMap              = tilesMap;
     this.locationsMap          = locationsMap;
     this.objectsMap            = objectsMap;
     this.random                = random;
     this.rouletteWheelSelector = new RouletteWheelSelector(random);
 }
        public ObjectGenerator(TilesMap map, Random random)
        {
            this.random = random;
            this.map    = map;

            rouletteWheelSelector = new RouletteWheelSelector(random);
            objectsMap            = new ObjectsMap(map.Width, map.Height);
            locationsMap          = new LocationsMap(map.Width, map.Height);
            locationsMap.MarkBlockedTiles(map);
        }
Пример #4
0
        public LocationShape(TilesMap tilesMap, LocationsMap locationsMap, Random random, Vector2Int position, int shapeSize)
        {
            this.locationsMap = locationsMap;

            LocationShapeGenerator locationShapeGenerator = new LocationShapeGenerator(tilesMap, locationsMap, random);

            bool[,] shapeMap = locationShapeGenerator.RandomLocationShape(position, shapeSize);

            LocationShapeSmoother locationShapeSmoother = new LocationShapeSmoother(locationsMap);

            AllTilesPositions = locationShapeSmoother.SmoothLocationShape(shapeMap);

            LocationShapeBorderSelector locationShapeBorderSelector = new LocationShapeBorderSelector(locationsMap, shapeMap, AllTilesPositions);

            BorderTilesPositions = locationShapeBorderSelector.ShapeBorder;
            NeighboringLocations = locationShapeBorderSelector.NeighboringLocations;

            SpaceTilesPositions = new List <Vector2Int>(AllTilesPositions);
            BorderTilesPositions.ForEach(block => SpaceTilesPositions.Remove(block));

            ShapeMap = new LocationTileType[locationsMap.Height, locationsMap.Width];
            SpaceTilesPositions.ForEach(tile => ShapeMap[tile.Y, tile.X]  = LocationTileType.Space);
            BorderTilesPositions.ForEach(tile => ShapeMap[tile.Y, tile.X] = LocationTileType.Border);
        }
 public LocationShapeSmoother(LocationsMap locationsMap)
 {
     this.locationsMap = locationsMap;
 }
 public LocationShapeGenerator(TilesMap tilesMap, LocationsMap locationsMap, Random random)
 {
     this.tilesMap              = tilesMap;
     this.locationsMap          = locationsMap;
     this.rouletteWheelSelector = new RouletteWheelSelector(random);
 }