Example #1
0
        public void CreateActors(Actors actorType, int count)//Adding actors to List and linking on Grid
        {
            int created = 0;

            while (created < count)
            {
                {
                    Actor actor = null;
                    switch (actorType)
                    {
                    case Actors.Snake:
                        actor = new Snake(1);
                        break;

                    case Actors.BullShit:
                        actor = new BullShit();
                        break;

                    case Actors.Rabbit:
                        actor = new Rabbit();
                        break;

                    case Actors.Fox:
                        actor = new Fox();
                        break;
                    }
                    actors.Add(actor);
                    grid[actor.coords] = actor;
                    created++;
                }
            }
        }
Example #2
0
 public void Breed()
 {
     for (int cik = World.instance.rnd.Next(MAX_OFFSPRINGS) + 1; cik > 0; cik--)
     {
         Coords freeCoords = new Coords(this.coords);
         if (FindeEmptyCell(ref freeCoords))
         {
             Fox newFox = new Fox(this.color, freeCoords, this.speed);
             World.instance.grid[newFox.coords] = newFox;
             World.instance.actors.Add(World.instance.grid[newFox.coords]);
         }
     }
 }