public Manager(List<PictureBox> pictureBoxes, ListBox display) { this.pictureBoxes = pictureBoxes; rGen = new Random(); this.display = display; continent = null; }
public Form1() { InitializeComponent(); Random randomGenerator = new Random(); canvas = CreateGraphics(); australia = new Australia(displayListBox, randomGenerator, canvas); northAmerica = new NorthAmerica(displayListBox, randomGenerator, canvas); africa = new Africa(displayListBox, randomGenerator, canvas); }
public Form1() { InitializeComponent(); //instantiate a canvas canvas = this.CreateGraphics(); //Instantiate continents na = new NorthAmerica(lbDisplayBox, rGen, ANIMAL_TYPE_COUNT, canvas); au = new Australia(lbDisplayBox, rGen, ANIMAL_TYPE_COUNT, canvas); an = new Antarctica(lbDisplayBox, rGen, ANIMAL_TYPE_COUNT, canvas); }
public void runSimulation(Continent newContinent) { //set the new continent continent = newContinent; // get a list of animals from the continent List<Animal> animals = continent.getAnimalList(); //for each animal set a set the picturebox and list box for(int i = 0; i < animals.Count; i++) { pictureBoxes[i].Image = animals[i].Image; display.Items.Add(animals[i].ToString()); } }
private void btn_Africa_Click(object sender, EventArgs e) { lb_Display.Items.Clear(); continent = new Africa(rGen, 4); manager.runSimulation(continent); }
//each button creates a new continent and calls the managers run simulation private void button1_Click(object sender, EventArgs e) { lb_Display.Items.Clear(); continent = new NorthAmerica(rGen, 4); manager.runSimulation(continent); }
private void btn_Australia_Click(object sender, EventArgs e) { lb_Display.Items.Clear(); continent = new Australia(rGen, 4); manager.runSimulation(continent); }