示例#1
0
        private List <List <Maze.Room> > GetOldRoads(Maze.Door door)
        {
            List <List <Maze.Room> > roomListList = new List <List <Maze.Room> >();

            foreach (List <Maze.Room> road in this.roads)
            {
                foreach (Maze.Room room in road)
                {
                    if (this.TwoDoorAreEqual(room.TopDoor, door))
                    {
                        roomListList.Add(road);
                        break;
                    }
                    if (this.TwoDoorAreEqual(room.BottonDoor, door))
                    {
                        roomListList.Add(road);
                        break;
                    }
                    if (this.TwoDoorAreEqual(room.LeftDoor, door))
                    {
                        roomListList.Add(road);
                        break;
                    }
                    if (this.TwoDoorAreEqual(room.RightDoor, door))
                    {
                        roomListList.Add(road);
                        break;
                    }
                }
            }
            return(roomListList);
        }
示例#2
0
 public Room()
 {
     this.topDoor         = new Maze.Door();
     this.bottonDoor      = new Maze.Door();
     this.leftDoor        = new Maze.Door();
     this.rightDoor       = new Maze.Door();
     this.topLeftDoor     = new Maze.Door();
     this.topRightDoor    = new Maze.Door();
     this.bottonLeftDoor  = new Maze.Door();
     this.bottonRightDoor = new Maze.Door();
 }
示例#3
0
 private void Interlink()
 {
     while (!this.AllRoomLinked())
     {
         List <Maze.Door>         outlineDoors = this.GetOutlineDoors(this.roads[this.random.UniformInt(0, 1048575) % this.roads.Count]);
         Maze.Door                door         = outlineDoors[this.random.UniformInt(0, 1048575) % outlineDoors.Count];
         List <List <Maze.Room> > oldRoads     = this.GetOldRoads(door);
         List <Maze.Room>         newRoad      = this.GetNewRoad(oldRoads);
         this.RemoveOldRoads(oldRoads);
         this.roads.Add(newRoad);
         door.OpenTheDoor();
     }
 }
示例#4
0
 private void AddOutlineDoor(Maze.Door door, List <Maze.Door> outlineDoors)
 {
     if (!door.GetLockState() || door.IsFixed)
     {
         return;
     }
     if (!outlineDoors.Contains(door))
     {
         outlineDoors.Add(door);
     }
     else
     {
         outlineDoors.Remove(door);
     }
 }
示例#5
0
 private bool TwoDoorAreEqual(Maze.Door doorSource, Maze.Door doorTarget)
 {
     return(doorSource.GetLockState() && !doorSource.IsFixed && object.Equals((object)doorSource, (object)doorTarget));
 }