public LandChunk(int altitudeMin, int altitudeMax, IntRect area) { this.Area = area; this.landObjectsArray = new List <LandCase[, ]>(); this.altitudeArray = new sbyte[this.Area.Height, this.Area.Width]; this.entitiesInChunk = new HashSet <IEntity>(); this.typesInChunk = new HashSet <Type>(); this.AltitudeMin = altitudeMin; this.AltitudeMax = altitudeMax; for (int z = 0; z < this.AltitudeMax - this.AltitudeMin + 1; z++) { LandCase[,] currentArray = new LandCase[this.Area.Height, this.Area.Width]; for (int i = 0; i < Area.Height; i++) { for (int j = 0; j < Area.Width; j++) { currentArray[i, j] = null; } } this.landObjectsArray.Add(currentArray); } }
public LandCase GetLandCaseAt(int x, int y, int z) { LandCase result = null; ILandChunk landChunk = this.GetLandChunkAt(x, y); if (landChunk != null) { result = landChunk.GetLandCase(y - landChunk.Area.Top, x - landChunk.Area.Left, z); } return(result); }