コード例 #1
0
 private void DPadTapped(FingersDPadScript script, FingersDPadItem item, TapGestureRecognizer gesture)
 {
     if (item == FingersDPadItem.Center)
     {
         Mover.transform.position = startPos;
     }
 }
コード例 #2
0
ファイル: DemoScriptDPad.cs プロジェクト: caglarenes/post-man
 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);
     }
 }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
        }