29 lines
624 B
C#
29 lines
624 B
C#
using UnityEngine;
|
|
|
|
public class TouchManager_Choose : MonoBehaviour
|
|
{
|
|
public GridSpawner gridSpawner;
|
|
public GridDisplaySpawner gridDisplaySpawner;
|
|
|
|
public System.Action<int, int> OnTap;
|
|
|
|
private GridTouchInput input;
|
|
|
|
void Start()
|
|
{
|
|
input = new GridTouchInput(gridSpawner, gridSpawner, gridDisplaySpawner);
|
|
input.IgnoreCurrentTouches();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
foreach (var t in input.Poll())
|
|
{
|
|
if (!t.OnCell) continue;
|
|
|
|
if (t.began) OnTap?.Invoke(t.x, t.y);
|
|
gridSpawner.gridCells[t.x, t.y].FlashWhite();
|
|
}
|
|
}
|
|
}
|