_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/MoveBg.cs
2024-12-05 15:48:55 +08:00

36 lines
737 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class MoveBg : MonoBehaviour
{
public static MoveBg instance;
public RectTransform rectTransform;
private float moveX = 1372;
public bool isMove;
// Start is called before the first frame update
void Start()
{
//StartMove();
instance = this;
}
public void StartMove()//¿ªÊ¼Òƶ¯
{
rectTransform.DOAnchorPosX(-moveX*2,5).SetEase(Ease.Linear);
isMove = true;
}
public void ReturnPos()//¹éλ
{
if (isMove)
{
rectTransform.DOAnchorPosX(0, 2).SetEase(Ease.Linear);
isMove = false;
}
}
}