コード例 #1
0
 public Corridor(Position startingPosition, Direction direction, int maxLenght, IFeature spawningFeature)
 {
     Trail = new List<Floor>();
     ConnectedFeatureA = spawningFeature;
     Direction = direction;
     InitTrail(startingPosition, maxLenght);
 }
コード例 #2
0
        private void InitTrail(Position startingPosition, int maxLenght)
        {
            Position increase;
            switch (Direction)
            {
                case Direction.North:
                    increase = Position.North;
                    break;

                case Direction.South:
                    increase = Position.South;
                    break;

                case Direction.East:
                    increase = Position.East;
                    break;

                default:
                    increase = Position.West;
                    break;
            }

            for (var i = 0; i < maxLenght; i++)
            {
                Trail.Add(new Floor(startingPosition + increase * i));
            }
        }
コード例 #3
0
ファイル: Room.cs プロジェクト: Ramzawulf/DungeonGenerator
 public Room(Position pos, int w, int h)
 {
     Position = pos;
     Width = w;
     Height = h;
     InitFloor();
     InitWalls();
 }
コード例 #4
0
        public TileType[,] Export()
        {
            var e = new TileType[Width, Height];

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    var key = new Position(x, y);
                    if (OccupiedPoints.ContainsKey(key))
                        e[x, y] = OccupiedPoints[key];
                    else
                        e[x, y] = TileType.Empty;
                }
            }

            return e;
        }