GetRooms() public method

public GetRooms ( ) : Pathfinding_Tests.Room[]
return Pathfinding_Tests.Room[]
Example #1
0
        private static Room[] LoadFromFile()
        {
            RoomBuilder  rb = new RoomBuilder();
            StreamReader s  = new StreamReader(File.Open("Maze2.txt", FileMode.Open));

            while (!s.EndOfStream)
            {
                string data = s.ReadLine();

                if (data.Length > 0)
                {
                    switch (data[0])
                    {
                    case '|':
                        rb.AppendWallsAndDoors(data.Substring(1));
                        break;

                    case ':':
                        rb.BeginNewRoom(data.Substring(1));
                        break;

                    default:
                        break;
                    }
                }
            }

            s.Dispose();
            return(rb.GetRooms());
        }
Example #2
0
        private static Room[] LoadFromFile()
        {
            RoomBuilder rb = new RoomBuilder();
            StreamReader s = new StreamReader(File.Open("Maze2.txt", FileMode.Open));

            while (!s.EndOfStream) {
                string data = s.ReadLine();

                if (data.Length > 0) {
                    switch (data[0]) {
                    case '|':
                        rb.AppendWallsAndDoors(data.Substring(1));
                        break;

                    case ':':
                        rb.BeginNewRoom(data.Substring(1));
                        break;

                    default:
                        break;
                    }
                }
            }

            s.Dispose();
            return rb.GetRooms();
        }