Exemplo n.º 1
0
        private void PlaceEnemies()
        {
            // for (int j = 1; j < 2; j++) {
            //     var numberOfEnemies = 1;

            //     for (int i = 0; i < numberOfEnemies; i++) {
            //         if (map.DoesRoomHaveWalkableSpace(map.Rooms[j])) {
            //             Point randomRoomPos = map.GetRandomPositionInRoom(map.Rooms[j]);
            //             if (randomRoomPos != null) {
            //                 map.AddEnemy(ActorGenerator.CreateEnemy(game, level, map.GetRandomPositionInRoom(map.Rooms[j])));
            //             }
            //         }
            //     }
            // }

            for (int j = 1; j < mapManager.Rooms.Count; j++)
            {
                if (Dice.Roll("1D10") < 7)
                {
                    var numberOfEnemies = 1;

                    for (int i = 0; i < numberOfEnemies; i++)
                    {
                        if (mapManager.DoesRoomHaveWalkableSpace(mapManager.Rooms[j]))
                        {
                            Point randomRoomPos = mapManager.GetRandomPositionInRoom(mapManager.Rooms[j]);
                            if (randomRoomPos != null)
                            {
                                mapManager.AddEnemy(ActorGenerator.CreateEnemy(game, mapLevel, mapManager.GetRandomPositionInRoom(mapManager.Rooms[j])));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void PlacePlayer()
        {
            Player player = ActorGenerator.CreatePlayer(game);

            player.X = mapManager.Rooms[0].Center.X;
            player.Y = mapManager.Rooms[0].Center.Y;

            mapManager.AddPlayer(player);
        }