private void DPadTapped(FingersDPadScript script, FingersDPadItem item, TapGestureRecognizer gesture) { if (item == FingersDPadItem.Center) { Mover.transform.position = startPos; } }
private void DPadTapped(FingersDPadScript script, FingersDPadItem item, TapGestureRecognizer gesture) { if ((item & FingersDPadItem.Center) != FingersDPadItem.None) { GameObject mover = (script == DPadScript ? Mover : Mover2); mover.transform.position = (script == DPadScript ? startPos : startPos2); } }
private void DPadPanned(FingersDPadScript script, FingersDPadItem item, PanGestureRecognizer gesture) { Vector3 pos = Mover.transform.position; float move = Speed * Time.deltaTime; if ((item & FingersDPadItem.Right) != FingersDPadItem.None) { pos.x += move; } if ((item & FingersDPadItem.Left) != FingersDPadItem.None) { pos.x -= move; } if ((item & FingersDPadItem.Up) != FingersDPadItem.None) { pos.y += move; } if ((item & FingersDPadItem.Down) != FingersDPadItem.None) { pos.y -= move; } Mover.transform.position = pos; }
private void DPadPanned(FingersDPadScript script, FingersDPadItem item, PanGestureRecognizer gesture) { Vector3 pos = Mover.transform.position; switch (item) { case FingersDPadItem.Up: pos.y += Speed * Time.deltaTime; break; case FingersDPadItem.Right: pos.x += Speed * Time.deltaTime; break; case FingersDPadItem.Down: pos.y -= Speed * Time.deltaTime; break; case FingersDPadItem.Left: pos.x -= Speed * Time.deltaTime; break; } Mover.transform.position = pos; }