Ejemplo n.º 1
0
    private Vector3 Direccion()
    {
        Vector3 move = Vector3.zero;

        move.x = joystic.Horizontal();
        move.z = joystic.Vertical();

        if (move.magnitude > 1)
        {
            move.Normalize();
        }

        return(move);
    }
Ejemplo n.º 2
0
    private Vector3 Direccion()
    {
        Vector3 move = Vector3.zero;

        move.x = joystic.Horizontal();
        move.z = joystic.Vertical();

        if (move.magnitude > 1)
        {
            move.Normalize();
        }

        if (move.magnitude > 0)
        {
            anim.Play("Locomotive");
            this.transform.Rotate(0f, move.x * walkSpd, 0f);
            this.transform.Translate(Vector3.forward * (walkSpd * move.z) * Time.deltaTime);
            anim.SetInteger("break", 99);
        }
        return(move);
    }