Exemplo n.º 1
0
        public List <List <Animal> > RestockColumns()
        {
            var restockedColumns = new List <List <Animal> >();

            for (var x = 0; x < Width; x++)
            {
                List <Animal> column = null;
                for (var y = 0; y < Height && _animals[x, y] == null; y++)
                {
                    if (_tiles[x, y] == null)
                    {
                        continue;
                    }

                    if (column == null)
                    {
                        column = new List <Animal>();
                        restockedColumns.Add(column);
                    }

                    column.Add(SetAnimalAt(x, y, new Animal(x, y, _random.ChooseFromEnum <AnimalType>())));
                }
            }

            return(restockedColumns);
        }