public Point GetMove(Point position, Cow cow)
        {
            Point returnPoint;
            if (position.Y + 1 < 11 && Stack[position.X, position.Y + 1] == null)
            {
                returnPoint = new Point(position.X, position.Y + 1); //move down move
            }
                //Precondition: it is either on the ground or on a cow
            else if (position.X + 1 < 12 && Stack[position.X + 1, position.Y] == null)
            {
                returnPoint = new Point(position.X + 1, position.Y); //move foward move
            }
                //Precondition: (either on the ground or on a cow) & space to the right is full or the space to the right is the wall
            else if (position.X + 1 < 12)
            {
                //Precondition: The space to the right is full of cow (crucially not wall)//Shouldn't ever go to high
                if (Stack[position.X + 1, position.Y - 1] == null)
                {
                    returnPoint = new Point(position.X + 1, position.Y - 1); //move up and across move
                }
                else //two cows on top
                {
                    returnPoint = position; //stop move
                }
            }
            else //at the wall & (either on the ground or on a cow)
            {
                if (position.Y <= 10 - wallManager.wallHeight) //then we are above the wall
                {
                    returnPoint = new Point(-1, -1); //climb over wall move TODO
                }
                else //we are stuck behind the wall
                {
                    returnPoint = position; //At wall move
                }
            }

            Stack[position.X, position.Y] = null;
            if(returnPoint.X!=-1||returnPoint.Y!=-1) {Stack[returnPoint.X, returnPoint.Y] = cow;}

            return returnPoint;
        }
 public void RemoveCow(Cow removeCow)
 {
     activeCows.Remove(removeCow);
     Meat newMeat = new Meat(this, GetTexture(typeof(Meat)), removeCow.cowPosition);
     activeMeats.Add(newMeat);
     collisionManager.addOther(newMeat);
     collisionManager.removeCow(removeCow);
 }
 private void GenerateCow()
 {
     Cow myCow;
     int ran = randomNumber.Next(10);
     switch (ran) {
         case 2:
         case 3: myCow = new KamikazeCow(this, wallManager, cowStack, h1Texture, h2Texture); break;
         case 5:
         case 6: myCow = new Bull(this, wallManager, cowStack, h1Texture, h2Texture); break;
         default: myCow =  new Cow(this, wallManager, cowStack, h1Texture, h2Texture, cowHealth); break;
     }
     activeCows.Add(myCow);
     collisionManager.addCow(myCow);
 }
 public Point FinishedMove(Cow cow, Point reached, Point last)
 {
     //Stack[last.X, last.Y] = null;
     //Stack[reached.X, reached.Y] = cow;
     return GetMove(reached, cow);
 }
 public Point AddCowToCowStack(Cow newCow)
 {
     Stack[startPoint.X, startPoint.Y] = newCow;
     return GetMove(startPoint, newCow);
 }
 public OtherCowLocations findCowCollisions(Cow cow)
 {
     Rectangle cowRectangle = cow.getCollisionRectangle();
     bool hasCowBelow = false;
     bool hasCowInJumpToPosition = false;
     bool hasCowNextToWithNoCowOnTop = false;
     bool notStoodOnGround = cowRectangle.Bottom < 400 - cowRectangle.Height ;
     foreach (ICollisionObject otherCowObject in otherObjects)
     {
         Cow otherCow = otherCowObject as Cow;
         if(otherCow != null)
         {
             if (!otherCow.Equals(cow) && otherCow.partOfPyramid)
             {
                 if (notStoodOnGround
                     && new Rectangle(
                             cowRectangle.X,
                             cowRectangle.Y + (int)(1.5*(float)cowRectangle.Height),
                             cowRectangle.Width,
                             cowRectangle.Height/2)
                         .Intersects(otherCow.getCollisionRectangle()))
                 {
                     //hasCowBelow = true;
                 }
                 if (new Rectangle(
                             cowRectangle.X + cowRectangle.Width/2,
                             cowRectangle.Y - (int)(1.5*(float)cowRectangle.Height),
                             cowRectangle.Width,
                             cowRectangle.Height)
                         .Intersects(otherCow.getCollisionRectangle()))
                 {
                     //looks to right & up to check for cow
                     hasCowInJumpToPosition = true;
                 }
                 else if (new Rectangle(
                             cowRectangle.X + cowRectangle.Width/2,
                             cowRectangle.Y,
                             cowRectangle.Width,
                             cowRectangle.Height)
                         .Intersects(otherCow.getCollisionRectangle()))
                 {
                     //just looks to right
                     hasCowNextToWithNoCowOnTop = true;
                 }
             }
         }
     }
     if(notStoodOnGround&&!hasCowBelow)
     {
         //return OtherCowLocations.ThereIsNoCowBelowCurrentCow;
     }
     if(hasCowInJumpToPosition)
     {
         return OtherCowLocations.ThereIsACowOnTopOfTheCowToTheRight;
     }
     if(hasCowNextToWithNoCowOnTop)
     {
         return OtherCowLocations.ThereIsACowNextToUsWithNoCowOnTop;
     }
     return OtherCowLocations.ThereIsNoCowToTheRight;
 }
 public void addCow(Cow cow)
 {
     otherObjects.Add(cow);
 }
 public void removeCow(Cow cow)
 {
     otherObjects.Remove(cow);
 }