Exemplo n.º 1
0
 protected override bool SearchForFood()
 {
     FoodTarget = FindTarget <FoodGrassEater>() as GrassEater;
     if (FoodTarget != null)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 protected override void EatIfPossible(int x, int y)
 {
     if (Field.Cells[x, y].ContainsCreature != null && Field.GetCreature <FoodGrassEater>(x, y) != null)
     {
         Fullness++;
         FoodTarget = null;
         EatCreature(x, y);
     }
 }
Exemplo n.º 3
0
 private void GenerateGrassEaters(int amount_of_grass_eaters)
 {
     for (int i = 0; i < amount_of_grass_eaters; i++)
     {
         int x = random.Next(0, Width);
         int y = random.Next(0, Height);
         if (Cells[x, y].BiomType != BiomType.water && Cells[x, y].ContainsCreature == null)
         {
             GrassEater newCreature = new GrassEater(x, y, random, Form, RandomGender(), this);
             GrassEaters.Add(newCreature);
             Cells[x, y].ContainsCreature = newCreature;
             Form.DrawCell(ref Cells[x, y], x, y);
         }
     }
 }
Exemplo n.º 4
0
        protected override void PutBabyInCell(Creature <FoodGrassEater> newCreature)
        {
            GrassEater Baby = new GrassEater(newCreature.x, newCreature.y, newCreature.random, newCreature.Form, newCreature.Gender, newCreature.Field);

            Field.Cells[x, y].ContainsCreature = Baby;
        }