-
Notifications
You must be signed in to change notification settings - Fork 0
/
MouseClick.cs
35 lines (29 loc) · 878 Bytes
/
MouseClick.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum Direction
{
Enter
}
public class MouseClick : MonoBehaviour {
private float maxSwipeDist = 18.0f;
private OneTouch OT;
// Use this for initialization
void Start()
{
OT = OneTouch.FindObjectOfType<OneTouch>();
}
// Update is called once per frame
void Update()
{
Tile TheTouchTile = gameObject.GetComponent<Tile>();
if (Input.touchCount > 0)
foreach (Touch touch in Input.touches)
if (touch.phase == TouchPhase.Began)
{
float gestureDist = (touch.position - (Vector2)transform.position).magnitude;
if (gestureDist < maxSwipeDist)
OT.Move(TheTouchTile.indRow, TheTouchTile.indCol);
}
}
}