示例#1
0
    void FixedUpdate()
    {
        GetComponent <Rigidbody>().velocity = moveJoy.MoveInput() * speed;                              //Move rigidbody;
        moveJoy.Rotate(transform, 15.0F);                                                               //Rotate rigidbody;
        rotateJoy.Rotate(Gun, 15.0F);                                                                   //Rotate gun;

        if (rotateJoy.IsPressed())                                                                      //Shooting;
        {
            Shoot();
        }
    }
示例#2
0
    /// <summary>
    /// Recebendo o tipo de entrada do usuario
    /// </summary>
    private void RecieveInput()
    {
        switch (_inputType)
        {
        case InputMode.Standard:
            _horizontalStandard = Input.GetAxis("Horizontal");
            _verticalStandard   = Input.GetAxis("Vertical");
            break;

        case InputMode.CrossPlatform:
            if (_easyJoystick == null)
            {
                if (_showDebugMessages)
                {
                    Debug.Log("Searching for EasyJoystick script");
                }
                _easyJoystick = GameObject.Find("ScreenJoystick").GetComponentInChildren <EasyJoystick>();
            }
            else
            {
                if (_showDebugMessages)
                {
                    Debug.Log("Getting input values");
                }
                _horizontalCrossPlatform = _easyJoystick.MoveInput().x;
                _verticalCrossPlatform   = _easyJoystick.MoveInput().z;
            }
            break;

        default:
            if (_showDebugMessages)
            {
                Debug.LogError("Input Type Unkown: " + _inputType);
            }
            break;
        }
    }