Example #1
0
 public void Restore(SchedulingSystem schedule)
 {
     CreateStairs();
     if (Game.mapLevel == 5)
     {
         // Setting the second stairs at 0,0 to avoid exception
         map.StairsDown.X = map.StairsDown.Y = 0;
     }
     foreach (Monster monster in map.Monsters)
     {
         schedule.Add(monster);
     }
     schedule.Add(Game.Player);
 }
Example #2
0
 // Creating default level
 public DungeonMap CreateMap(SchedulingSystem schedule)
 {
     map.Initialize(width, height);
     BuildCaves();
     GetCaves();
     ConnectCaves();
     foreach (List <Point> cave in Caves)
     {
         CreateRoom(cave);
     }
     CreateTunnel(Corridors);
     CreateStairs();
     PlacePlayer();
     PlaceMonsters();
     return(map);
 }
Example #3
0
        // Creating the final level of the game
        // Killing the final boss will end the game
        // So there is no need to create stairs down
        public DungeonMap CreateFinalLevel(SchedulingSystem schedule)
        {
            map.Initialize(width, height);
            Rectangle playerSpawn = new Rectangle(10, height / 2 - 5, 8, 8);
            Rectangle bossSpawn   = new Rectangle(width / 2, 0, width / 2 - 1, height - 2);

            List <ICell> playerRoom = new List <ICell>();
            List <ICell> bossRoom   = new List <ICell>();

            for (int i = playerSpawn.X; i < playerSpawn.X + playerSpawn.Width; i++)
            {
                for (int j = playerSpawn.Y; j < playerSpawn.Y + playerSpawn.Height; j++)
                {
                    map.SetCellProperties(i, j, true, true, false);
                    playerRoom.Add(map.GetCell(i, j));
                }
            }

            for (int i = bossSpawn.X; i < bossSpawn.X + bossSpawn.Width; i++)
            {
                for (int j = bossSpawn.Y; j < bossSpawn.Y + bossSpawn.Height; j++)
                {
                    map.SetCellProperties(i, j, true, true, false);
                    bossRoom.Add(map.GetCell(i, j));
                }
            }

            for (int i = playerSpawn.Center.X; i < bossSpawn.Center.X; i++)
            {
                map.SetCellProperties(i, playerSpawn.Center.Y, true, true, false);
            }
            map.Rooms.Add(playerRoom);
            map.Rooms.Add(bossRoom);
            PlacePlayer();

            var dragon = Dragon.Create(1);

            dragon.X = bossSpawn.Center.X;
            dragon.Y = bossSpawn.Center.Y;

            map.AddMonster(dragon);
            CreateStairs();
            // Setting the second stairs at 0,0 to avoid exception
            map.StairsDown.X = map.StairsDown.Y = 0;
            return(map);
        }
Example #4
0
        public static void ActivateMonsters(SchedulingSystem schedule)
        {
            IScheduleable scheduleable = schedule.Get();

            if (scheduleable is Player)
            {
                IsPlayerTurn = true;
                schedule.Add(Game.Player);
            }
            else
            {
                Monster monster = scheduleable as Monster;

                if (monster != null)
                {
                    monster.PerformAction();
                    schedule.Add(monster);
                }

                ActivateMonsters(schedule);
            }
        }