33 lines
940 B
C#
33 lines
940 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class ContentMove : MonoBehaviour
|
|||
|
{
|
|||
|
public RectTransform content; // Scroll View<65><77>Content
|
|||
|
public float speed; // <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|||
|
|
|||
|
private float startPositionX;
|
|||
|
public RectTransform startpos;
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
startPositionX = startpos.anchoredPosition.x;
|
|||
|
speed = 225f;
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD>Content
|
|||
|
content.anchoredPosition += Vector2.right * speed * Time.deltaTime;
|
|||
|
|
|||
|
// <20><>Content<6E>뿪<EFBFBD><EBBFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
if (content.anchoredPosition.x + content.rect.width / 2 > content.rect.width)
|
|||
|
{
|
|||
|
startPositionX = startpos.anchoredPosition.x- content.rect.width;
|
|||
|
content.anchoredPosition = new Vector2(startPositionX, content.anchoredPosition.y);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|