public void Go(Random random) { Hive.Go(random); //добавит и пчёл for (int і = Bees.Count - 1; і >= 0; і--) { Bee bee = Bees[і]; bee.Go(random); if (bee.CurrentState == Bee.BeeState.Retired) { Bees.Remove(bee); } } double totalNectarHarvested = 0; for (int i = Flowers.Count - 1; i >= 0; i--) { Flower flower = Flowers[i]; flower.Go(); totalNectarHarvested += flower.NectarHarvested; if (!flower.Alive) { Flowers.Remove(flower); } } if (totalNectarHarvested > NectarHarvestedPerNewFlower)//опыление->появление нового цветка { foreach (Flower flower in Flowers) { flower.NectarHarvested = 0; } AddFlower(random); } }
public void AddBee(Random random) { hive.beeCount++; int r1 = random.Next(30); int r2 = random.Next(30); Point startPoint = new Point(hive.GetLocation("Nursery").X + r1, hive.GetLocation("Nursery").Y + r2); Bee newBee = new Bee(hive.beeCount, startPoint, world, hive); newBee.MessageSender += this.MessageSender; world.Bees.Add(newBee); }
private void AddBee(Random random) { beeCount++; int r1 = random.Next(40); int r2 = random.Next(40); Point startPoint = new Point(locations["Nursery"].X + r1, locations["Nursery"].Y + r2); Bee newBee = new Bee(beeCount, startPoint, world, this); newBee.MessageSender += this.MessageSender; world.Bees.Add(newBee); }
private BeeControl GetBeeControl(Bee bee) { BeeControl beeControl; if (!beeLookup.ContainsKey(bee)) { beeControl = new BeeControl() { Width = 20, Height = 20 }; beeLookup.Add(bee, beeControl); hiveForm.Controls.Add(beeControl); beeControl.BringToFront(); } else { beeControl = beeLookup[bee]; } return(beeControl); }