Пример #1
0
        void StartButtonClick(object sender, EventArgs e)
        {
            // Create board.
            // N.B. All Points are in abstract integer sizes to relate each Room/Tile to each other.
            // 		These sizes are converted to actual pixels in DrawLocation().
            initialOrigin = new Point(scale,scale);	//N.B. Origin is currently selected to display trial board centered in graphics window!;
            origin = initialOrigin;

            // Board to create is dependent on the user selection of difficulty in the difficultySelectorPanel
            if(difficultyRadioButton_easy.Checked) board = new Board(1);
            if(difficultyRadioButton_medium.Checked) board = new Board(2);

            // Populate remainingBaddies from Board
            remainingBaddies = new List<Character>();
            foreach(Room room in board.rooms)
            {
                foreach(Character baddie in room.occupants)
                {
                    remainingBaddies.Add(baddie);
                }
            }

            // N.B. This list starts off empty! (as all baddies are behind doors).
            visibleBaddies = new List<Character>();

            // Create Heroes from checkBox selections in herosSelectorPanel.
            heroes = new List<Character>();

            // Add Heroes to start square of Board (stairs down tile)
            // N.B. location of Heroes within the square is checked and assigned in AssignLocation(), so no location conflicts occur.

            if (warriorSelectCheckBox.Checked){
                heroes.Add(new Hero (board.AssignLocation(board.rooms[0]), board.startDirection, 8, 6, 6, 8, 4, HeroType.Warrior));
                board.rooms[0].occupants.Add(heroes[heroes.Count-1]);
            }
            if (dwarfSelectCheckBox.Checked){
                heroes.Add(new Hero (board.AssignLocation(board.rooms[0]), board.startDirection, 8, 5, 6, 8, 5, HeroType.Dwarf));
                board.rooms[0].occupants.Add(heroes[heroes.Count-1]);
            }
            if (elfSelectCheckBox.Checked){
                heroes.Add(new Hero (board.AssignLocation(board.rooms[0]), board.startDirection, 9, 9, 5, 5, 4, HeroType.Elf));
                board.rooms[0].occupants.Add(heroes[heroes.Count-1]);
            }
            if (wizardSelectCheckBox.Checked){
                heroes.Add(new Wizard (board.AssignLocation(board.rooms[0]), board.startDirection, 5, 6, 4, 4, 3, HeroType.Wizard));
                board.rooms[0].occupants.Add(heroes[heroes.Count-1]);
            }

            // If no heroes are selected, assign Warrior only.
            if (heroes.Count == 0) heroes.Add(new Hero (board.AssignLocation(board.rooms[0]), (Direction) random.Next(4), 8, 6, 6, 8, 4, HeroType.Warrior));

            // Assign active hero (1st in Heroes List)
            activeHero = (Hero) heroes[0];

            // Set up GUI controls.
            ResetGame();
        }
Пример #2
0
 void ActivateHeroButton4Click(object sender, EventArgs e)
 {
     activeHero = (Hero) heroes[3];
     DrawActionButtons();
 }