Created
June 12, 2016 05:16
-
-
Save sukedon/fdd9d72da3437914f043d7c7fce50bc3 to your computer and use it in GitHub Desktop.
ジョイスティック使用サンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SamplePlayerController : MonoBehaviour { | |
[SerializeField] | |
private JoystickController _controller; | |
// Use this for initialization | |
void Start () { | |
_controller.OnDragEvent += Move; | |
_controller.OnDragEndEvent += MoveEnd; | |
} | |
private void Move(Vector2 diff){ | |
//コントローラーの値が渡ってきます | |
transform.Translate(diff.normalized.x,0f,diff.normalized.y); | |
} | |
private void MoveEnd(){ | |
Debug.Log("ドラッグおわったお"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment