hch
2025-09-11 aa72688fbfcba5cf8d90a7b34700bbe1f9ebee12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using UnityEngine;
using UnityEngine.UI;
 
public class TestMoveToTarget : MonoBehaviour
{
    public RectTransform sourceRect;
    public RectTransform targetRect;
    public Vector2 offset = Vector2.zero;
    public float duration = 1f;
 
    [ContextMenu("Test MoveToTarget")]
    public void TestMove()
    {
        if (sourceRect == null || targetRect == null)
        {
            Debug.LogError("请在Inspector中指定sourceRect和targetRect!");
            return;
        }
 
        BattleUtility.MoveToTarget(sourceRect, targetRect, offset, duration, () =>
        {
            Debug.Log("移动完成!");
        });
    }
}