示例#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;
 }
示例#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();
        }
示例#3
0
 public Farmyard RemoveAnimals(AnimalResource type, int count)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.RemoveAnimals(type, count), HouseType));
 }
示例#4
0
 public Farmyard AssignAnimals(AnimalHousingData[] assignments)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.AssignAnimals(assignments), HouseType));
 }
示例#5
0
 public Farmyard UpdateAnimalManager(AnimalHousingData[] animalAssignments)
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.Update(this.Grid, this.Pastures, animalAssignments), HouseType));
 }
示例#6
0
 /// <summary>
 /// Updates the animal manager.
 /// </summary>
 public Farmyard UpdateAnimalManager()
 {
     return(new Farmyard(Grid, Pastures, Fences, AnimalManager.Update(this.Grid, this.Pastures), HouseType));
 }
示例#7
0
 public int AnimalCount(AnimalResource Type)
 {
     return(AnimalManager.GetAnimalCount(Type));
 }