Пример #1
0
    void FixedUpdate()
    {
        if (controlType == ControlType.joystick)
        {
            moveHorizontal = moveJoystick.position.x;
            moveVertical   = moveJoystick.position.y;
        }
        else if (controlType == ControlType.tilt)
        {
            moveJoystick.Disable();
            moveHorizontal = Input.acceleration.x;
            moveVertical   = Input.acceleration.y + 0.5f;
        }
        else
        {
            moveJoystick.Disable();
            moveHorizontal = Input.GetAxis("Horizontal");
            moveVertical   = Input.GetAxis("Vertical");
        }


        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        GetComponent <Rigidbody>().velocity = movement * speed;

        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)
                                              );

        GetComponent <Rigidbody>().rotation = Quaternion.Euler(0.0f, 0.0f, GetComponent <Rigidbody>().velocity.x * -tilt);
    }
Пример #2
0
    void  OnEndGame()
    {
        // Disable joystick when the game ends
        moveJoystick.Disable();
        rotateJoystick.Disable();

        // Don't allow any more control changes when the game ends
        this.enabled = false;
    }
Пример #3
0
    void OnEndGame()
    {
        // Disable joystick when the game ends
        moveTouchPad.Disable();

        if (rotateTouchPad)
        {
            rotateTouchPad.Disable();
        }

        // Don't allow any more control changes when the game ends
        this.enabled = false;
    }
Пример #4
0
 // ----------------------------------------------------------------------------------------------------
 // Stuff to do on game end
 // ----------------------------------------------------------------------------------------------------
 void OnEndGame()
 {
     m_MoveJoystick.Disable();
     m_RotateJoystick.Disable();
     this.enabled = false;
 }
Пример #5
0
 void OnEndGame()
 {
     moveJoystick.Disable();
     enable = false;
 }
Пример #6
0
 void OnEndGame()
 {
     moveJoystick.Disable();
     this.enabled = false;
 }