public bool eatHoney(Bee bee)
 {
     this.Honey -= bee.Appetite;
     if (this.Honey >= 0)
         return true;
     else
         return false;
 }
        private void beesList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i    = beesList.SelectedIndex;
            Bee temp = hive.getBee(i);

            this.beeNumber.Text   = temp.Number.ToString();
            this.beeState.Text    = temp.state.ToString();
            this.beeAppetite.Text = temp.Appetite.ToString();
            this.beePosition.Text = temp.position.X + ", " + temp.position.Y;
        }
示例#3
0
 public bool eatHoney(Bee bee)
 {
     this.Honey -= bee.Appetite;
     if (this.Honey >= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public void updateBeeList()
        {
            this.hiveHoney.Text = hive.Honey.ToString();
            this.hiveTime.Text  = hive.hiveHours / 24 + "d " + hive.hiveHours % 24 + "h (" + hive.hiveHours + "hours)";
            this.isDay.Text     = hive.isDay ? "Day" : "Night";
            beesList.Items.Clear();

            for (int i = 0; i < Int32.Parse(numberBees.Text); i++)
            {
                Bee temp = hive.getBee(i);
                beesList.Items.Add("Bee#" + i + ":\tState: " + temp.state + "\tPosition: " + temp.position.X + ", " + temp.position.Y);
            }
            //beesList.Invalidate();
        }
示例#5
0
        public BeeHive(int numBees, int Honey, Point Entry, HiveEnvironment environment, Form1 form)
        {
            bees             = new Bee[numBees];
            this.Honey       = Honey;
            this.Entry       = Entry;
            this.environment = environment;
            this.form        = form;
            this.numBees     = numBees;

            rGen  = new Random();
            run   = true;
            isDay = true;

            for (int i = 0; i < numBees; i++)
            {
                bees[i] = new Bee(i, this.rGen, this);
            }
        }
        public BeeHive(int numBees, int Honey, Point Entry, HiveEnvironment environment, Form1 form)
        {
            bees = new Bee[numBees];
            this.Honey = Honey;
            this.Entry = Entry;
            this.environment = environment;
            this.form = form;
            this.numBees = numBees;

            rGen = new Random();
            run = true;
            isDay = true;

            for (int i = 0; i < numBees; i++)
            {
                bees[i] = new Bee(i, this.rGen, this);
            }
        }
示例#7
0
 public void addHoney(Bee bee)
 {
     this.Honey += bee.getHoney();
 }
 public void addHoney(Bee bee)
 {
     this.Honey += bee.getHoney();
 }