mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 15:37:39 +02:00
Discord rich presence
This commit is contained in:
34
Assets/Scripts/Common/Scroll.cs
Normal file
34
Assets/Scripts/Common/Scroll.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Common
|
||||
{
|
||||
public class Scroll : MonoBehaviour
|
||||
{
|
||||
public float scrollSpeedX;
|
||||
public float scrollSpeedY;
|
||||
Vector3 startPos;
|
||||
|
||||
public float lengthX;
|
||||
public float lengthY = 43.20976f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
startPos = transform.localPosition;
|
||||
UpdatePos();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdatePos();
|
||||
}
|
||||
|
||||
private void UpdatePos()
|
||||
{
|
||||
float newPosX = Mathf.Repeat(Time.time * scrollSpeedX, lengthX);
|
||||
float newPosY = Mathf.Repeat(Time.time * scrollSpeedY, lengthY);
|
||||
transform.localPosition = startPos + new Vector3(1 * newPosX, 1 * newPosY);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user