Esempio n. 1
0
    void FixedUpdate()
    {
        float XmoveHorizontal = DataConversion.GetHorizontalMove();
        //float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        //		Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
        //		GetComponent<Rigidbody>().velocity = movement * speed;

        GetComponent <Rigidbody>().position = new Vector3
                                              (
            XmoveHorizontal,
            0.0f,
            0.0f
                                              );


        GetComponent <Rigidbody>().position = new Vector3
                                              (
            Mathf.Clamp(GetComponent <Rigidbody>().position.x, boundary.xMin, boundary.xMax),
            0.0f,
            Mathf.Clamp(GetComponent <Rigidbody>().position.z, boundary.zMin, boundary.zMax)
                                              );
//
        if (((GetComponent <Rigidbody>().position.x < 0.3) && (GetComponent <Rigidbody>().position.x > -0.3)) || (GetComponent <Rigidbody>().position.x == 6) || (GetComponent <Rigidbody>().position.x == -6))
        {
            openFire = true;
        }


        GetComponent <Rigidbody>().rotation = Quaternion.Euler(0.0f, 0.0f, GetComponent <Rigidbody>().velocity.x * -tilt);
    }