Beispiel #1
0
        private void whackBee(int whichBee)
        {
            Bee hitBee = BeeHive[whichBee];

            if (hitBee.beeType == BeeType.Queen)
            {
                HitMessage = "Queen whacked!  ";
                BeeHive[whichBee].lifeSpan = BeeHive[whichBee].lifeSpan - 8;
                if (BeeHive[whichBee].lifeSpan < 1)
                {
                    BeeHive[whichBee].status = BeeStatus.Dead;
                    foreach (Bee b in BeeHive)
                    {
                        b.lifeSpan = 0;
                        b.status   = BeeStatus.Dead;
                    }
                    HitMessage = "Queen dead - GAME OVER!";
                }
            }
            else if (hitBee.beeType == BeeType.Worker)
            {
                HitMessage = " Worker " + (whichBee).ToString() + "  whacked!  ";
                BeeHive[whichBee].lifeSpan = BeeHive[whichBee].lifeSpan - 10;
                if (BeeHive[whichBee].lifeSpan < 1)
                {
                    BeeHive[whichBee].status = BeeStatus.Dead;
                    HitMessage = "Worker dead";
                }
            }
            else if (hitBee.beeType == BeeType.Drone)
            {
                HitMessage = " Drone " + (whichBee).ToString() + "  whacked!  ";
                BeeHive[whichBee].lifeSpan = BeeHive[whichBee].lifeSpan - 12;
                if (BeeHive[whichBee].lifeSpan < 1)
                {
                    BeeHive[whichBee].status = BeeStatus.Dead;
                    HitMessage = "Drone dead";
                }
            }
            else
            {
                //error
                HitMessage = "Error!";
            }
            string myLine = hitBee.beeId.ToString() + " " + HitMessage;

            myLog.Add(myLine);
        }
Beispiel #2
0
        public void CreateHive()
        {
            BeeHive = new List <Bee>();
            myLog   = new List <string>();
            // create queen
            Bee queen = new Bee(BeeType.Queen, 25, 0);

            BeeHive.Add(queen);
            // create workers
            for (int i = 1; i < 5; i++)
            {
                Bee worker = new Bee(BeeType.Worker, 25, i);
                BeeHive.Add(worker);
            }
            // create drones
            for (int i = 0; i < 8; i++)
            {
                Bee drone = new Bee(BeeType.Drone, 10, 5 + i);
                BeeHive.Add(drone);
            }
            beeWhacked = -1;
            HitMessage = "Hive created!";
        }