【Unity】【NGUI】NGUIにVirtual Joystick(NGUI用)を追加してみた ref: http://qiita.com/shori0917/items/0b3237eb13889d3ea053
UIJoystick joystick; | |
void Start() { | |
this.joystick = GameObject.FindGameObjectWithTag("Joystick").GetComponent<UIJoystick>(); | |
} | |
void Update() { | |
if (this.joystick.position.y > 0) | |
{ | |
transform.position += new Vector3(0, _speed * Time.deltaTime, 0); | |
} | |
else if (this.joystick.position.y < 0) | |
{ | |
transform.position -= new Vector3(0, _speed * Time.deltaTime, 0); | |
} | |
if (this.joystick.position.x > 0) | |
{ | |
transform.position += new Vector3(_speed * Time.deltaTime, 0, 0); | |
} | |
else if (this.joystick.position.x < 0) | |
{ | |
transform.position -= new Vector3(_speed * Time.deltaTime, 0, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment