public CellProfile GetCellProfile(CellData cell) { var nineCells = new NativeArray <WorleyNoise.CellData>(9, Allocator.Temp); int arrayIndex = 0; for (int x = -1; x < 2; x++) { for (int z = -1; z < 2; z++) { int2 otherCellIndex = new int2(x, z) + cell.index; CellData newCell = GetCellData(otherCellIndex); if (x == 0 && z == 0) { nineCells[arrayIndex] = cell; } else { nineCells[arrayIndex] = newCell; } arrayIndex++; } } CellProfile cellProfile = bowyerWatson.GetCellProfile(nineCells, cell); nineCells.Dispose(); return(cellProfile); }
// TODO Это тоже надо как-то интегрировать с landscape.json /** TODO Что, если данные о стоимости терраформирования не хранить в типе данных, * а считать прямо перед созданием стройплощадки? Тогда она требовала бы следующие * данные: численность крестьян, состояние клетки, тип местности, высота местности, * целевой тип местности. Может, что ещё. Это упростило бы класс и формат landscape.json * Да, так и нужно сделать. **/ protected LandType( int id, string name, int populationLimit, float taxLimit, float cross, bool civil = false, PlaceType place = PlaceType.Earth, CellProfile profile = CellProfile.WarOnly, Age level = Age.StoneAge ) { Id = id; Name = name; YieldLimit = taxLimit; Envirounment = place; Orient = profile; Level = level; Cross = cross; Civilization = civil; Capacity = Math.Max(1000, populationLimit); switch (place) { case PlaceType.Air: case PlaceType.Water: case PlaceType.Bridge: Hobbitable = 0; break; case PlaceType.Earth: Hobbitable = (1 + (civil ? 1 : 0)) * populationLimit / 2; break; case PlaceType.Port: Hobbitable = populationLimit; break; } }
public Landscape(int id, string name, int populationLimit, float taxLimit, float cross, bool civil = false, PlaceType place = PlaceType.Earth, CellProfile profile = CellProfile.WarOnly, Age level = Age.StoneAge) : base(id, name, populationLimit, taxLimit, cross, civil, place, profile, level) { }
public void Add(CellProfile cellProfile) { Add(cellProfile.Position.x, cellProfile.Position.y, cellProfile.Score); }