Beispiel #1
0
        public void UpdateWorldChunk(ref ChunkData chunkData)
        {
            for (var i = 0; i < chunkData.StaticTileData.Length; i++)
            {
                var chunkTile = Tiles[i];
                if (chunkTile.TileId != chunkData.StaticTileData[i].TileId ||
                    chunkTile.Z != chunkData.StaticTileData[i].Z ||
                    chunkTile.Hue != chunkData.StaticTileData[i].Hue)
                {
                    Tiles[i] = new ChunkStaticTile(chunkTile.TileId, chunkTile.Z, chunkTile.Hue);
                    IsDirty  = true;
                }
            }

            for (var i = 0; i < chunkData.ItemTileData.Length; i++)
            {
                var chunkTile = Items[i];
                if (chunkTile.TileId != chunkData.ItemTileData[i].TileId ||
                    chunkTile.Z != chunkData.ItemTileData[i].Z ||
                    chunkTile.Hue != chunkData.ItemTileData[i].Hue)
                {
                    Items[i] = new ChunkItemTile(chunkTile.TileId, chunkTile.Z, chunkTile.Hue);
                    IsDirty  = true;
                }
            }
        }
Beispiel #2
0
 public virtual bool Equals(ChunkItemTile other)
 {
     if (other == null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(TileId == other.TileId && Z == other.Z && Hue == other.Hue);
 }
Beispiel #3
0
 public WorldChunk(Point position)
 {
     Position = position;
     Tiles    = new ChunkStaticTile[ChunkData.ChunkSize * ChunkData.ChunkSize];
     for (var i = 0; i < Tiles.Length; i++)
     {
         Tiles[i] = new ChunkStaticTile(0, 0, 0);
     }
     Items = new ChunkItemTile[ChunkData.ChunkSize * ChunkData.ChunkSize];
     for (var i = 0; i < Tiles.Length; i++)
     {
         Items[i] = new ChunkItemTile(0, 0, 0);
     }
     IsDirty = false;
 }