private void SetTileTexture(TDTile tile, int tileType, int x, int z) { // we don't need to set old tile type if current type is PATH_PAST or PATH_CURRENT if (tile.GetTileType() != (int)TILE_TYPE.PATH_NEXT && tile.GetTileType() != (int)TILE_TYPE.PATH_CURRENT) { tile.SetOldTileType(tile.GetTileType()); } tile.SetTileType(tileType); if (tileType == (int)TILE_TYPE.STARTPOINT) { map.SetStartPoint(tile); } else if (tileType == (int)TILE_TYPE.ENDPOINT) { map.SetEndPoint(tile); } texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, spriteArray[tileType]); //texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, tilePixels[tileType]); texture.Apply(); }