Example #1
0
        public void ChangeBeeState()
        {
            //it is going to the transition point and needs to be disposed
            if (directionToTransitionPoint)
            {

                Controls.Remove(bee);
                bee.timer.Stop();
                bee.Dispose();
                bee = null;
                FlowerForm.MoveTowardsFlower();
                directionToTransitionPoint = !directionToTransitionPoint;
            }

            else
            {

                if (FlowerForm.flowersLife>0)
                {
                    bee.timer.Stop();
                    Thread.Sleep(new TimeSpan(0, 0, 1));
                    bee.timer.Start();
                    this.bee.destination = this.BeesTransitionPoint;
                    directionToTransitionPoint = !directionToTransitionPoint;
                }
            }
        }
Example #2
0
        public void ChangeBeeState()
        {
            //it has reached to the flower now it needs to be reveresed
            if (!directionToTransitionPoint)
            {
                bee.timer.Stop();
                Thread.Sleep(new TimeSpan (0,0,1));
                bee.timer.Start();
                flowersLife--;
                setFlowerTimer();
                if (flowersLife == 0)
                    MessageBox.Show("Flower is dead");
                this.bee.destination = BeesTransitionPoint;
                directionToTransitionPoint = !directionToTransitionPoint;
            }

            else
            {

                this.Controls.Remove(bee);
                this.bee.Dispose();
                bee = null;
                BeeHouse.SetDestinationToHome();
                directionToTransitionPoint = !directionToTransitionPoint;

            }
        }
Example #3
0
        //Move the bee towards it's home when it
        //files in from the FormOfflower
        public void SetDestinationToHome()
        {
            bee = new BeeController(this)
                {
                    location = this.BeesTransitionPoint,
                    destination = this.pictureBoxBeeHome.Location
                };

                Controls.Add(bee);
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (bee == null)
            {
                bee = new BeeController(this)
                {
                    location = this.pictureBoxBeeHome.Location,
                    destination = this.BeesTransitionPoint

                };

                Controls.Add(bee);
                Controls.Remove((Button)sender);
            }
        }
Example #5
0
        //Move the bee towaards flower
        public void MoveTowardsFlower()
        {
            //Uuups!!! no bee , lets create one :)

            if (bee == null)
            {

                bee = new BeeController(this)
                {
                    location = new Point(0, 0),
                    destination = this.FlowePictureBox.Location
                };

                Controls.Add(bee);

                setFlowerTimer();
            }//if (bee == null)
        }