public Bee(int id, Point location, Hive hive, World world)
        {
            ID = id;
            this.location = location;
            InsideHive = true;
            destinationFlower = null;
            NectarCollected = 0;
            CurrentState = BeeState.Idle;
            this.world = world;
            this.hive = hive;

            MessageSender = hive.MessageSender;
        }
        public void Go(Random random)
        {
            Age++;
            BeeState oldState = CurrentState;

            switch (CurrentState)
            {
                case BeeState.Idle :
                    if (Age > CarrerSpan)
                    {
                        CurrentState = BeeState.Retired;
                    }
                    else if (world.flowers.Count > 0 && hive.ConsumeHoney(HoneyConsumed))
                    {
                        Flower flower = world.flowers[random.Next(world.flowers.Count)];
                        if (flower.Nectar >= MinimumFlowerNectar && flower.Alive)
                        {
                            destinationFlower = flower;
                            CurrentState = BeeState.FlyingToFlower;
                        }
                    }
                    break;

                case BeeState.FlyingToFlower:
                    if (! world.flowers.Contains(destinationFlower))
                    {
                        CurrentState = BeeState.ReturningToHive;
                    }
                    else if (InsideHive)
                    {
                        if (MoveTowardsLocation(hive.GetLocation("Exit")))
                        {
                            InsideHive = false;
                            location = hive.GetLocation("Entrance");
                        }
                    }
                    else if (MoveTowardsLocation(destinationFlower.Location))
                    {
                        CurrentState = BeeState.GatheringNectar;
                    }
                    break;

                case BeeState.GatheringNectar:
                    double nectar = destinationFlower.Nectar;
                    if (nectar > 0)
                    {
                        NectarCollected += nectar;
                    }
                    else
                    {
                        CurrentState = BeeState.ReturningToHive;
                    }
                    break;

                case BeeState.ReturningToHive:
                    if (!InsideHive)
                    {
                        if (MoveTowardsLocation(hive.GetLocation("Entrance")))
                        {
                            InsideHive = true;
                            location = hive.GetLocation("Exi");
                        }
                    }
                    else
                    {
                        if (MoveTowardsLocation(hive.GetLocation("HoneyFactory")))
                        {
                            CurrentState = BeeState.MakingHoney;
                        }
                    }
                    break;

                case BeeState.MakingHoney:
                    if (NectarCollected < 0.5)
                    {
                        NectarCollected = 0;
                        CurrentState = BeeState.Idle;
                    }
                    else
                    {
                        if (hive.AddHoney(0.5))
                        {
                            NectarCollected -= 0.5;
                        }
                        else
                        {
                            NectarCollected = 0;
                        }
                    }
                    break;

                case BeeState.Retired:

                    break;
            }

            if (oldState != CurrentState && MessageSender != null)
            {
                MessageSender(ID, CurrentState.ToString());
            }
        }
        private void AddFlower(Random random)
        {
            Point location = new Point(random.Next(FieldMinX, FieldMaxX),
                                       random.Next(FiledMinY, FieldMaxY));

            Flower newFlower = new Flower(location, random);
            flowers.Add(newFlower);
        }