Skip to content

Instantly share code, notes, and snippets.

@shoridevel shoridevel/Player.cs
Created Jul 27, 2013

Embed
What would you like to do?
【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
You can’t perform that action at this time.