예제 #1
0
    private Vector3 PoolInput()
    {
        Vector3 dir = Vector3.zero;

        dir.x = joyStickScript.Horizontal();
        dir.y = joyStickScript.Vertical();

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

        return(dir);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        cube.transform.Translate(new Vector3(moveSpeed * joystick.Horizontal() * Time.deltaTime, 0f, moveSpeed * joystick.Vertical() * Time.deltaTime));



        /*
         * if(Input.GetKey(KeyCode.UpArrow)){
         *              cube.transform.position += new Vector3(0,0,0.1f);
         *      }
         *
         * if(Input.GetKey(KeyCode.DownArrow)){
         *      cube.transform.position -= new Vector3(0,0,0.1f);
         *
         * }
         * if(Input.GetKey(KeyCode.RightArrow)){
         *              cube.transform.position += new Vector3(0.1f,0,0);
         * }
         *
         * if(Input.GetKey(KeyCode.LeftArrow)){
         *      cube.transform.position -= new Vector3(0.1f,0,0);
         * }
         *
         * if(Input.GetKey(KeyCode.Space) && cube.transform.position.y < 5)
         * {
         *      cube.transform.position += new Vector3(0,0.3f,0);
         * }*/
    }