Parallax Test
parallax test
This commit is contained in:
16
Assets/Quentin/ParallaxLayer.cs.cs
Normal file
16
Assets/Quentin/ParallaxLayer.cs.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class ParallaxLayer : MonoBehaviour
|
||||
{
|
||||
public float parallaxFactor;
|
||||
|
||||
public void Move(float delta)
|
||||
{
|
||||
Vector3 newPos = transform.localPosition;
|
||||
newPos.x -= delta * parallaxFactor;
|
||||
|
||||
transform.localPosition = newPos;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user