mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 10:05:14 +00:00
2ca9cbbb1d
First Contact - Fixed a bug Tap Trial - All anims and input are implemented Air Rally - Initialization
31 lines
710 B
C#
31 lines
710 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ScrollForTap : 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);
|
|
}
|
|
}
|