private void HandleTurfUpdate(NetIncomingMessage message) { short x = message.ReadInt16(); short y = message.ReadInt16(); TileType type = (TileType)message.ReadByte(); if (IsSaneArrayPosition(x, y)) { Tiles.Atmos.GasCell g = tileArray[x, y].gasCell; var t = GenerateNewTile(x, y, type) as Tile; tileArray[x, y] = t as Tile; tileArray[x, y].gasCell = g; g.AttachToTile(t); NetworkUpdateTile(x, y); } }
/// <summary> /// This function takes the gas cell from one tile and moves it to another, reconnecting all of the references in adjacent tiles. /// Use this when a new tile is generated at a map location. /// </summary> /// <param name="fromTile">Tile to move gas information/cell from</param> /// <param name="toTile">Tile to move gas information/cell to</param> public void MoveGasCell(ITile fromTile, ITile toTile) { Tiles.Atmos.GasCell g = (fromTile as Tile).gasCell; (toTile as Tile).gasCell = g; g.AttachToTile((toTile as Tile)); }