Exemplo n.º 1
0
        /// <summary>
        /// Handles placing food piles and nests at the mouse click location.
        /// Adds the generated nests and food piles to the relevant list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Information on the mouseclick such as co-ordinates.</param>
        private void groundPanel_MouseUp(object sender, MouseEventArgs e)
        {
            int tempX       = 0;
            int tempY       = 0;
            int tempRations = 8;

            placePoint = e.Location;

            tempX = placePoint.X;
            tempY = placePoint.Y;

            if (e.Button == MouseButtons.Left)
            {
                Food tempFood;
                tempFood = new Food(tempX, tempY, foodPileNumber, tempRations);
                foodList.Add(tempFood);
                foodPileNumber++;
            }
            else if (e.Button == MouseButtons.Right)
            {
                Nest tempNest;
                tempNest = new Nest(tempX, tempY, nestList.Count + 1);
                nestList.Add(tempNest);
            }
        }
Exemplo n.º 2
0
 public Ant(Nest n)
     : base(new Location(n.Location), 4)
 {
     _nest               = n;
     _state              = PathingState.GetFood;
     _maxFood            = 1;
     _pheremoneThreshold = GameLogic.Random.Next(10, 1000);
 }
Exemplo n.º 3
0
 /// <summary>
 /// The ant deposits the food into his nest.
 /// </summary>
 /// <param name="locN">Passes in the Nest object.</param>
 private void GiveFood(Nest locN)
 {
     locN.DepositFood(HasFood);
     HasFood = 0;
 }
Exemplo n.º 4
0
 /// <summary>
 /// The ant memorises the colony location and sets the colony as his own.
 /// </summary>
 /// <param name="locN">Passes in the next object.</param>
 private void RememberColony(Nest locN)
 {
     Colony = locN.Colony;
     NestX  = locN.MyX;
     NestY  = locN.MyY;
 }