Exemplo n.º 1
0
        // Constructs an xSize by ySize map. Default Tile set to TileBasicFloor.
        public Map(UInt16 xSize, UInt16 ySize, Int32 seed)
        {
            // creates and fills the tile array
            this._xMax = xSize;
            this._yMax = ySize;

            this._pixelMaxX = (UInt32)(xSize * Constants.TileSize);
            this._pixelMaxY = (UInt32)(ySize * Constants.TileSize);

            _tiles         = new Tile[xSize, ySize];
            _visibilityMap = new float[xSize, ySize];
            // tiles = new TileBasicFloor[xSize, ySize];
            for (Int32 i = 0; i < xSize; i++)
            {
                for (Int32 j = 0; j < ySize; j++)
                {
                    _tiles[i, j] = new TilePassable(this, new Coords(CoordsType.Tile, i, j), Constants.TileGeneratorGrass);
                }
            }

            this._passabilityMap = new BitArray[xSize];
            for (int i = 0; i < xSize; ++i)
            {
                _passabilityMap[i] = new BitArray(ySize);
            }

            this._myCollider          = new Collider(xSize, ySize, Constants.TileSize, Constants.TileSize, _passabilityMap);
            this._myVisibilityTracker = new VisiblityTracker(xSize, ySize, Constants.TileSize, Constants.TileSize, _passabilityMap, _visibilityMap);
            this._myPathfinder        = new Pathfinder(_passabilityMap);

            // initializes the random number generator associated with this map
            this._randomator = new RandomStuff(seed);
        }
Exemplo n.º 2
0
        // Generates random pixel to go to.
        private void GoSomewhere()
        {
            Map         currentMap  = this.MyCreature.InhabitedMap;
            RandomStuff randomator  = currentMap.Randomator;
            Coords      targetPixel = new Coords(CoordsType.Pixel, (Int32)randomator.NSidedDice((UInt16)currentMap.PixelBoundX, 1) - 1,
                                                 (Int32)randomator.NSidedDice((UInt16)currentMap.PixelBoundY, 1) - 1);

            //Coords targetTile = new Coords(CoordsType.Tile, targetPixel);
            List <Creature> clipCheck = _owner.MyCollider.CreatureClippingCheck(this.MyCreature, targetPixel, false);

            if (clipCheck != null && clipCheck.Count == 0)
            {
                MyNavigator      = new Navigator(this.MyCreature, targetPixel, false);
                _thinkingCounter = (int)randomator.NSidedDice(1000, 1);
            }
        }
Exemplo n.º 3
0
        // Constructs an xSize by ySize map. Default Tile set to TileBasicFloor.
        public Map(UInt16 xSize, UInt16 ySize, Int32 seed)
        {
            // creates and fills the tile array
            this._xMax = xSize;
            this._yMax = ySize;

            this._pixelMaxX = (UInt32)(xSize * Constants.TileSize);
            this._pixelMaxY = (UInt32)(ySize * Constants.TileSize);

            _tiles = new Tile[xSize, ySize];
            _visibilityMap = new float[xSize, ySize];
            // tiles = new TileBasicFloor[xSize, ySize];
            for (Int32 i = 0; i < xSize; i++)
            {
                for (Int32 j = 0; j < ySize; j++)
                {
                    _tiles[i, j] = new TilePassable(this, new Coords(CoordsType.Tile, i, j), Constants.TileGeneratorGrass);
                }
            }

            this._passabilityMap = new BitArray[xSize];
            for (int i = 0; i < xSize; ++i)
            {
                _passabilityMap[i] = new BitArray(ySize);
            }

            this._myCollider = new Collider(xSize, ySize, Constants.TileSize, Constants.TileSize, _passabilityMap);
            this._myVisibilityTracker = new VisiblityTracker(xSize, ySize, Constants.TileSize, Constants.TileSize, _passabilityMap, _visibilityMap);
            this._myPathfinder = new Pathfinder(_passabilityMap);

            // initializes the random number generator associated with this map
            this._randomator = new RandomStuff(seed);
        }
 public WorldGeneration(Int32 seed)
 {
     this._randomator = new RandomStuff(seed);
 }
 public WorldGeneration(Int32 seed)
 {
     this._randomator = new RandomStuff(seed);
 }