2025-04-16 19:57:54 -04:00
|
|
|
using UnityEngine; using Game; using Music; using Player;
|
|
|
|
|
namespace Game
|
|
|
|
|
{
|
2025-03-03 11:35:56 -05:00
|
|
|
public class InfiniteScroll : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public float speed;
|
|
|
|
|
public float start;
|
|
|
|
|
public float end;
|
|
|
|
|
|
2025-03-28 17:39:07 -04:00
|
|
|
private void Update() // Moves the background
|
2025-03-03 11:35:56 -05:00
|
|
|
{
|
|
|
|
|
if (transform.position.x > end)
|
|
|
|
|
{
|
|
|
|
|
transform.position = new Vector3(start, transform.position.y, transform.position.z);
|
|
|
|
|
}
|
|
|
|
|
else if (transform.position.x < start)
|
|
|
|
|
{
|
|
|
|
|
transform.position = new Vector3(end, transform.position.y, transform.position.z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transform.position += speed * Time.deltaTime * Vector3.right;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-16 19:57:54 -04:00
|
|
|
}
|