private void row2Space5Button_Click(object sender, EventArgs e) { if (peashooterPlaceMode == true && sun >= 100) { peashooter pea10 = new peashooter(plantSize, 485 - plantSize, laneTwoHeight + plantSize * 2); peashooterList.Add(pea10); if (peashooterTimer.Enabled == false) { peashooterTimer.Enabled = true; } PlaceCancel(); sun -= 100; } else if (sunflowerPlaceMode == true && sun >= 50) { sunflower sunflower10 = new sunflower(plantSize, 485 - plantSize, laneTwoHeight + plantSize * 2); sunflowerList.Add(sunflower10); if (sunflowerTimer.Enabled == false) { sunflowerTimer.Enabled = true; } PlaceCancel(); sun -= 50; } else if (shovelMode == true) { //remove plant } }
private void row1Space1Button_Click(object sender, EventArgs e) { if (peashooterPlaceMode == true && sun >= 100) { peashooter pea1 = new peashooter(plantSize, 190 - plantSize, laneOneHeight + plantSize * 2); peashooterList.Add(pea1); peashooterTimer.Enabled = true; PlaceCancel(); sun -= 100; } else if (sunflowerPlaceMode == true && sun >= 50) { sunflower sunflower1 = new sunflower(plantSize, 190 - plantSize, laneOneHeight + plantSize * 2); sunflowerList.Add(sunflower1); if (sunflowerTimer.Enabled == false) { sunflowerTimer.Enabled = true; } PlaceCancel(); sun -= 50; } else if (shovelMode == true) { foreach (peashooter p in peashooterList) { peashooterList.Remove(p); return; } foreach (sunflower s in sunflowerList) { sunflowerList.Remove(s); return; } } }