Ejemplo n.º 1
0
        public static List<RoomSprite> FillRect(Game _game, Rectangle wall,Color colour,Tileset tset,Color glowcolour)
        {
            List<RoomSprite> _roomSpriteList = new List<RoomSprite>();

            int x = (int)(wall.Width / Globals.SmallGridSize.X);
            int y = (int)(wall.Height / Globals.SmallGridSize.Y);
            for (int i = 1; i <= x; i++)
            {
                for (int j = 1; j <= y; j++)
                {
                    var wallblock = new SmallBlock01(_game, new Vector2(wall.Location.X + (i * Globals.SmallGridSize.X) - Globals.SmallGridSize.X,
                                                                        wall.Location.Y - (j * Globals.SmallGridSize.Y))
                                                                        , colour,tset,glowcolour);
                    _roomSpriteList.Add(wallblock);
                }
            }
            return _roomSpriteList;
        }
Ejemplo n.º 2
0
        private void createCave(Game _game, Vector2 Position, Vector2 _size, RoomDoorPositionsInfo DoorPositions, RoomAmbiance ambient)
        {
            CaveGenerator cavegen = new CaveGenerator();
            _solidGrid = cavegen.GenerateCave(_size, DoorPositions);

            for (int x = 1; x < _solidGrid.GetLength(0) - 1; x++)
            {
                for (int y = 1; y < _solidGrid.GetLength(1) - 1; y++)
                {
                    if (_solidGrid[x, y] == true)
                    {

                        bool solid = false;
                        foreach (var coord in Globals.GetMoore(x, y))
                        {
                            if (_solidGrid[coord.Item1, coord.Item2] == false) solid = true;
                        }
                        if (solid == true)
                        {
                            var solidblock = new SolidSmallBlock01(_game, new Vector2(Position.X + (x * Globals.SmallGridSize.X),
                                                                              Position.Y + (y * Globals.SmallGridSize.Y)), ambient.RoomColour
                                                                              , MaterialsStats.Rock01);
                            DestructibleWalls.Add(solidblock);
                        }
                        else
                        {
                            var wallblock = new SmallBlock01(_game, new Vector2(Position.X + (x * Globals.SmallGridSize.X),
                                                                              Position.Y + (y * Globals.SmallGridSize.Y)), ambient.RoomColour);
                            _interiorSpriteList.Add(wallblock);
                        }
                    }
                }
            }
        }