using System.Collections;
using UnityEngine;

public class Background : MonoBehaviour
{
    public BackgroundLayer[] backgroundLayers;

    public void Scroll(float scrollX, float scrollY)
    {
        // Make background container follow camera movement
        transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, transform.position.z);

        // Shift background layers to create parallax effect
        foreach (BackgroundLayer bgl in backgroundLayers)
            bgl.Scroll(scrollX, scrollY);
    }
}
