public void AddLayer(Texture2D picture, float depth, float moveRate) // Para añadir distintos fondos { BackgroundLayer layer = new BackgroundLayer(); layer.picture = picture; layer.depth = depth; layer.moveRate = moveRate; layer.pictureSize.X = picture.Width; layer.pictureSize.Y = picture.Height; layerList.Add(layer); // Lo añadimos al layerList definido en el constructor después de definir sus propiedades }
public int CompareDepth(BackgroundLayer layer1, BackgroundLayer layer2) //Compara la profundidad de distinos fondos { if (layer1.depth < layer2.depth) { return(1); } if (layer1.depth > layer2.depth) { return(-1); } if (layer1.depth == layer2.depth) { return(0); } return(0); }