/// <summary> /// Save all layers as a texture in the hard drive as a png image /// </summary> public void SaveToHDD() { for (int i = 0; i < layers.Length; i++) { HDDResources.SaveImage(layers[i].GetTexture(), "layer" + i); } }
public Map() { layers = new IntArrayFromTexture[depth]; for (int i = 0; i < layers.Length; i++) { layers[i] = new IntArrayFromTexture(); //Load the texture from hard drive if it exist Texture2D layer = HDDResources.LoadImage("layer" + i); if (layer) { layers[i].SetTexture(layer); } else //Create a black texture otherwise { layer = new Texture2D(width, height); Color[] colors = new Color[width * height]; for (int j = 0; j < colors.Length; j++) { colors[j] = Color.black; } layer.SetPixels(colors); layers[i].SetTexture(layer); } } }
/// <summary> /// Saves a custom color palette in persistence data path as a png file /// </summary> public static void SavePaletteInHardDrive() { SetColorsArray(); Texture2D texture = new Texture2D(cols, rows); texture.SetPixels32(colors); texture.filterMode = FilterMode.Point; texture.Apply(); HDDResources.SaveImage(texture, "palette"); }