25 lines
560 B
C#
25 lines
560 B
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class CameraTouchArea : MonoBehaviour, IPointerDownHandler, IDragHandler
|
|
{
|
|
public static Vector2 LookDelta;
|
|
|
|
private Vector2 lastPosition;
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
{
|
|
lastPosition = eventData.position;
|
|
}
|
|
|
|
public void OnDrag(PointerEventData eventData)
|
|
{
|
|
LookDelta = eventData.position - lastPosition;
|
|
lastPosition = eventData.position;
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
LookDelta = Vector2.zero;
|
|
}
|
|
} |