mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
21 lines
409 B
C#
21 lines
409 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class BhvBackgroundScroller : MonoBehaviour
|
|
{
|
|
public float ScrollSpeed;
|
|
public float TileSizeZ;
|
|
|
|
private Vector3 _startPosition;
|
|
|
|
void Start ()
|
|
{
|
|
_startPosition = transform.position;
|
|
}
|
|
|
|
void Update ()
|
|
{
|
|
float newPosition = Mathf.Repeat(Time.time * ScrollSpeed, TileSizeZ);
|
|
this.transform.position = _startPosition + Vector3.forward * newPosition;
|
|
}
|
|
} |