private void AddBee(Random random) { _beeCount++; int r1 = random.Next(100) - 50; int r2 = random.Next(100) - 50; var startPoint = new Point(_locations["Nursery"].X + r1, _locations["Nursery"].Y + r2); var newBee = new Bee(_beeCount, startPoint, this, _world); newBee.MessageSender += MessageSender; _world.Bees.Add(newBee); }
public void AddBee(Random random) { beeCount++; int r1 = random.Next(100) - 50; int r2 = random.Next(100) - 50; 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 void AddBee(Random random) { beeCount++; int r1 = random.Next(100) - 50; int r2 = random.Next(100) - 50; 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); // Once we have a system, we need to add this bee to the system }
private BeeControl GetBeeControl(Bee bee) { BeeControl beeControl; if (!beeLookup.ContainsKey(bee)) { beeControl = new BeeControl() { Width = 40, Height = 40 }; beeLookup.Add(bee, beeControl); hiveForm.Controls.Add(beeControl); beeControl.BringToFront(); } else { beeControl = beeLookup[bee]; } return(beeControl); }
public void Go(Random random) { Hive.Go(random); for (int i = Bees.Count - 1; i >= 0; i--) { Bee bee = Bees[i]; bee.Go(random); if (bee.CurrentState == 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); } }
private BeeControl GetBeeControl(Bee bee) { BeeControl beeControl; if (!beeLookup.ContainsKey(bee)) { beeControl = new BeeControl() { Width = 40, Height = 40 }; beeLookup.Add(bee, beeControl); hiveForm.Controls.Add(beeControl); beeControl.BringToFront(); } else beeControl = beeLookup[bee]; return beeControl; }