This commit is contained in:
2026-05-12 01:22:46 +07:00
parent 685b3b6e12
commit 1ee0f7ef7d
77 changed files with 6012 additions and 1036 deletions

View File

@@ -0,0 +1,31 @@
using UnityEngine;
using UnityEngine.EventSystems;
public class FlickArea : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public BallShooter ballShooter;
private Vector2 startPos;
private float startTime;
public void OnPointerDown(PointerEventData eventData)
{
startPos = eventData.position;
startTime = Time.time;
}
public void OnPointerUp(PointerEventData eventData)
{
Vector2 endPos = eventData.position;
float endTime = Time.time;
Vector2 swipeDelta = endPos - startPos;
float swipeTime = endTime - startTime;
// Ensure swipeTime is not 0 to avoid division by zero
if (swipeTime > 0 && ballShooter != null)
{
ballShooter.FlickShoot(swipeDelta, swipeTime);
}
}
}