2025-03-01 19:08:48 +01:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
/// <summary>
|
2025-03-15 03:58:28 +01:00
|
|
|
/// Move each layer
|
|
|
|
/// Original script: https://pastebin.com/ZniykeGz.
|
|
|
|
/// YouTube link: https://youtu.be/MEy-kIGE-lI.
|
2025-03-01 19:08:48 +01:00
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public class ParallaxLayer : MonoBehaviour
|
|
|
|
{
|
|
|
|
public float parallaxFactor;
|
|
|
|
|
|
|
|
public void Move(float delta)
|
|
|
|
{
|
|
|
|
Vector3 newPos = transform.localPosition;
|
|
|
|
newPos.x -= delta * parallaxFactor;
|
|
|
|
|
|
|
|
transform.localPosition = newPos;
|
|
|
|
}
|
2025-03-15 03:58:28 +01:00
|
|
|
}
|