Пример #1
0
 public Interior(InteriorNames interiorname, Game _game, Vector2 Position, Vector2 _size, RoomDoorPositionsInfo DoorPositions, RoomAmbiance ambient)
 {
     switch (interiorname)
     {
         case InteriorNames.Empty:
             break;
         case InteriorNames.Cave:
             createCave(_game, Position, _size, DoorPositions, ambient);
             break;
     }
 }
Пример #2
0
 public bool[,] GenerateCave(Vector2 size, RoomDoorPositionsInfo doorpositions)
 {
     depth = 2;
     area = (int)(size.X * size.Y);
     solidGrid = new bool[(int)size.X * Globals.Xgrid, (int)size.Y * Globals.Ygrid];
     representWalls();
     int percent = 35 + (area*2);
     if (percent >47)
     {
         percent = 48;
     }
     randomize(percent);
     makeDoorExclusionZones(doorpositions.PositionsArray);
     //iter1(4);
     iter2(6);
     return solidGrid;
 }
Пример #3
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);
                        }
                    }
                }
            }
        }