_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/snailFactory/PointFollow.cs

22 lines
544 B
C#
Raw Normal View History

2024-12-08 20:16:04 +08:00
using UnityEngine;
using UnityEngine.EventSystems;
public class PointFollow : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
2024-12-09 12:00:50 +08:00
public Vector3 StarTransform;
2024-12-08 20:16:04 +08:00
public void OnBeginDrag(PointerEventData eventData)
{
2024-12-09 12:00:50 +08:00
StarTransform = transform.position;
2024-12-09 15:33:32 +08:00
Debug.Log(1111111);
2024-12-08 20:16:04 +08:00
}
public void OnDrag(PointerEventData eventData)
{
transform.position = eventData.position;
}
public void OnEndDrag(PointerEventData eventData)
{
2024-12-09 12:00:50 +08:00
transform.position = StarTransform;
2024-12-08 20:16:04 +08:00
}
}