public bool OnCollision(IGameObject other)
 {
     Debug.Print("At Door");
     foreach (Point p in visible)
     {
         dungeon.SetVisible(p, true);
     }
     return(true);
 }
Beispiel #2
0
        /// <summary>
        /// Acts as the entrance point for the rest of the generator. Actually produces a dungeon
        /// with the given number of rooms, in the space given in the constructor.
        /// </summary>
        /// <param name="count">Number of rooms to be generated</param>
        public void Generate(int count)
        {
            initialize();

            for (int i = 0; i < count; i++)
            {
                Room    room       = new Room(this, rand.Next(MIN_ROOM_WIDTH, MAX_ROOM_WIDTH), rand.Next(MIN_ROOM_HEIGHT, MAX_ROOM_HEIGHT));
                Point   spawn      = room.Random();
                Monster newMonster = new Monster(spawn, rand);
                dungeon.PlaceObject(newMonster, spawn);
                monsters.Add(newMonster);
            }

            while (sets > 1)
            {
                Room current = rooms[rand.Next(rooms.Count)];
                Room near    = nearest(current);
                if (near != null)
                {
                    new Path(this, current, near);
                }
            }

            Point point = getValidPoint();

            dungeon.PlaceObject(new Exit(point, dungeon), point);


            Room playerRoom = rooms[rand.Next(rooms.Count)];

            point = playerRoom.Center;
            Player player = new Player(point, dungeon.rand);

            dungeon.Player = player;
            dungeon.PlaceObject(player, point);
            dungeon.SetVisible(playerRoom.Visible, true);
        }