public void spawnPlayers() { gameStarted = true; grid = SceneGeneration.getGrid(); width = SceneGeneration.width; height = SceneGeneration.height; SpawnPlayer(); }
protected void GenerateSceneBtn_Click(object sender, EventArgs e) { Random rnd = new Random(); int randomChoice; if (DropDownList1.SelectedItem.Text == "Random") //if location is unselected { //choose random location randomChoice = rnd.Next(1, DropDownList1.Items.Count); loc = DropDownList1.Items[randomChoice].Text; } else { // use the chosen location in dropdown loc = DropDownList1.SelectedItem.Text; } if (DropDownList2.SelectedItem.Text == "Random") //if time is unselected { //choose random time randomChoice = rnd.Next(1, DropDownList2.Items.Count); time = DropDownList2.Items[randomChoice].Text; } else { // use the chosen time in dropdown time = DropDownList2.SelectedItem.Text; } if (DropDownList3.SelectedItem.Text == "Random") //if race is unselected { //choose random race randomChoice = rnd.Next(1, DropDownList3.Items.Count); personRace = DropDownList3.Items[randomChoice].Text; } else { // use the chosen race in dropdown personRace = DropDownList3.SelectedItem.Text; } if (DropDownList4.SelectedItem.Text == "Random") //if SceneType is unselected { //choose random scene type randomChoice = rnd.Next(1, DropDownList4.Items.Count); sceneType = DropDownList4.Items[randomChoice].Text; } else { // use the chosen scene type in dropdown sceneType = DropDownList4.SelectedItem.Text; } sGenerator = new SceneGeneration(loc, time, personRace, sceneType); SceneLbl.Text = sGenerator.generateScene(); }