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

17 lines
540 B
C#
Raw Normal View History

2024-12-05 15:48:55 +08:00
using UnityEngine;
using DG.Tweening; // <20><><EFBFBD><EFBFBD> DOTween <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
public class CameraAutoMove : MonoBehaviour
{
public GameObject targetPos;//Ŀ<><C4BF>λ<EFBFBD><CEBB>
public float targetXPosition = 10f; // Ŀ<><C4BF>λ<EFBFBD>õ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public float moveDuration; // ƽ<>Ƴ<EFBFBD><C6B3><EFBFBD>ʱ<EFBFBD><CAB1>
void Start()
{
// ʹ<><CAB9> DOTween ʵ<><CAB5>ƽ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>
// Ŀ<><C4BF>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD>ǰλ<C7B0>õ<EFBFBD> Y <20><> Z ֵ<><D6B5><EFBFBD>䣬X ֵ<>趨Ϊ targetXPosition
transform.DOMoveX(targetPos.transform.position.x, moveDuration)
.SetEase(Ease.Linear); // <20><><EFBFBD>Թ<EFBFBD><D4B9>ɣ<EFBFBD>ƽ<EFBFBD>ȵ<EFBFBD>ƽ<EFBFBD><C6BD>
}
}