sửa demo bài

This commit is contained in:
2026-05-04 15:03:03 +07:00
parent 2c1a9318fa
commit 8bf28a39fa
7 changed files with 295 additions and 180 deletions

View File

@@ -1,31 +0,0 @@
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);
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: a39d896efd271d648ab60642c63b9556