public static TileMask fromData(byte[] data) { TileMask mask = new TileMask(); mask.mask = data; return(mask); }
public static TileMask fromTexture(Texture2D texture) { TileMask mask = new TileMask(); Color[] colors = new Color[mask.width * mask.height]; texture.GetData <Color>(colors); for (int y = 0; y < mask.height; y++) { for (int x = 0; x < mask.width; x++) { if (colors[x + y * mask.width] == Color.Black) { mask.mask[x + y * mask.width] = 1; } } } return(mask); }
public Tile(TileSet tileSet, TileMask mask, uint tileId) { this.tileSet = tileSet; this.mask = mask; this.tileId = tileId; }