Пример #1
0
    void FixedUpdate()
    {
        Vector2 direction = touch.GetDirection();

        if (direction.x != 0f)
        {
            transform.Rotate(Vector3.up, -direction.x * touchSmothing);
        }
    }
Пример #2
0
    void FixedUpdate()
    {
        if (pad == null)
        {
            print("pad is null");
            return;
        }

        Vector3 movemend = pad.GetDirection();
        float   x        = movemend.x;
        float   y        = movemend.y;

        if (x != 0.0f && y != 0.0f)
        {
            if (Mathf.Abs(x) - Mathf.Abs(y) > 0.1f)
            {
                //mobe vertical
                if (x > 0.1f)
                {
                    //v=0f;
                    moveTo.z = 1f;
                    //Debug.Log("move verical stanga ");
                }
                else
                {
                    //v=0f;
                    moveTo.z = -1f;
                    //Debug.Log("move verical dreapta");
                }
            }
            else
            {
                if (y > 0.1f)
                {
                    jump = true;
                }
                else
                {
                    slide = true;
                }
            }
        }
        person.Move(moveTo, jump, slide);

        slide  = false;
        jump   = false;
        moveTo = Vector3.zero;
    }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     rigitBody.AddForce(touchPad.GetDirection(), ForceMode.Impulse);
 }
Пример #4
0
 // Update is called once per frame
 void Update()
 {
     transform.Rotate(touchPad.GetDirection() * Rotation * Time.deltaTime);
 }