_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/MoveBg.cs

36 lines
737 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class MoveBg : MonoBehaviour
{
public static MoveBg instance;
public RectTransform rectTransform;
2024-12-05 15:48:55 +08:00
private float moveX = 1372;
2024-12-05 15:48:55 +08:00
public bool isMove;
// Start is called before the first frame update
void Start()
{
2024-12-05 15:48:55 +08:00
//StartMove();
instance = this;
}
public void StartMove()//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
{
2024-12-05 15:48:55 +08:00
rectTransform.DOAnchorPosX(-moveX*2,5).SetEase(Ease.Linear);
isMove = true;
}
public void ReturnPos()//<2F><>λ
{
2024-12-05 15:48:55 +08:00
if (isMove)
{
rectTransform.DOAnchorPosX(0, 2).SetEase(Ease.Linear);
isMove = false;
}
}
}