Example #1
0
        private Field CreateField(Index2d size, int creatureCount, int speed, int vision, int maxHealth)
        {
            var field = new Field(size);
            var rand  = new Random();

            for (int i = 0; i < creatureCount; i++)
            {
                var creature = new Ex1Creature(speed, vision, maxHealth);
                int x, y;
                do
                {
                    x = rand.Next(0, size.X);
                    y = rand.Next(0, size.Y);
                }while (!field.AddEntity(creature, (x, y, x + creature.Size - 1, y + creature.Size - 1)));
            }
            return(field);
        }