Ejemplo n.º 1
0
 private Farmyard(
     ImmutableList <FarmyardEntity> grid,
     ImmutableArray <int[]> pastures,
     ImmutableList <int> fences,
     AnimalManager animalManager,
     HouseType houseType)
 {
     this.Pastures      = pastures;
     this.Grid          = grid;
     this.Fences        = fences;
     this.AnimalManager = animalManager;
     this.HouseType     = houseType;
 }
Ejemplo n.º 2
0
        public Farmyard()
        {
            HouseType = HouseType.Wood;
            var gridBuilder = new List <FarmyardEntity>();

            for (var x = 0; x < WIDTH; x++)
            {
                for (var y = 0; y < HEIGHT; y++)
                {
                    gridBuilder.Add(new Empty(x, y));
                }
            }
            Fences        = ImmutableList <int> .Empty;
            Pastures      = ImmutableArray <int[]> .Empty;
            AnimalManager = new AnimalManager();
            Grid          = gridBuilder.ToImmutableList();
        }
Ejemplo n.º 3
0
 public Farmyard RemoveAnimals(AnimalResource type, int count)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.RemoveAnimals(type, count), HouseType));
 }
Ejemplo n.º 4
0
 public Farmyard AssignAnimals(AnimalHousingData[] assignments)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.AssignAnimals(assignments), HouseType));
 }
Ejemplo n.º 5
0
 public Farmyard UpdateAnimalManager(AnimalHousingData[] animalAssignments)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.Update(this.Grid, this.Pastures, animalAssignments), HouseType));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Updates the animal manager.
 /// </summary>
 public Farmyard UpdateAnimalManager()
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.Update(this.Grid, this.Pastures), HouseType));
 }
Ejemplo n.º 7
0
 public int AnimalCount(AnimalResource Type)
 {
     return(AnimalManager.GetAnimalCount(Type));
 }