Skip to content

Instantly share code, notes, and snippets.

@sukedon
Created June 12, 2016 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sukedon/fdd9d72da3437914f043d7c7fce50bc3 to your computer and use it in GitHub Desktop.
Save sukedon/fdd9d72da3437914f043d7c7fce50bc3 to your computer and use it in GitHub Desktop.
ジョイスティック使用サンプル
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