回答編集履歴
1
もっといい方法があった
answer
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
```csharp
|
2
2
|
using UnityEngine;
|
3
|
-
using UnityEngine.
|
3
|
+
using UnityEngine.EventSystems;
|
4
|
-
using System.Collections;
|
5
|
-
using System.Collections.Generic;
|
6
4
|
|
7
|
-
public class SwipeMove :
|
5
|
+
public class SwipeMove : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
|
8
6
|
Vector2 startPos;
|
9
7
|
Vector3 pos;
|
10
8
|
float mov;
|
11
9
|
|
12
|
-
public
|
10
|
+
public void OnPointerDown( PointerEventData data )
|
13
11
|
{
|
14
12
|
startPos = data.position;
|
15
13
|
}
|
16
14
|
|
17
|
-
public
|
15
|
+
public void OnPointerUp( PointerEventData data )
|
18
16
|
{
|
19
17
|
mov = (data.position.y - startPos.y) / 100;
|
20
18
|
if (transform.position.z <= 0 && transform.position.z >= -2) {
|
@@ -28,5 +26,5 @@
|
|
28
26
|
|
29
27
|
こうですかねぇ
|
30
28
|
|
29
|
+
[Unity - EventSystems.IPointerDownHandler](https://docs.unity3d.com/ScriptReference/EventSystems.IPointerDownHandler.html)
|
31
|
-
[Unity -
|
30
|
+
[Unity - EventSystems.IPointerUpHandler](https://docs.unity3d.com/ScriptReference/EventSystems.IPointerUpHandler.html)
|
32
|
-
[uGUIチュートリアル まとめ6 UI EventとEvent Trigger](http://unitech.hatenablog.com/entry/2017/04/20/235106)
|