OVRGamepadController is an interface class to a gamepad controller.
Inheritance: MonoBehaviour
Esempio n. 1
0
    // ShowLevels
    bool ShowLevels()
    {
        if (Scenes.Length == 0)
        {
            ScenesVisible = false;
            return(ScenesVisible);
        }

        bool curStartDown = false;

        if (OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Start) == true)
        {
            curStartDown = true;
        }

        if ((PrevStartDown == false) && (curStartDown == true) ||
            Input.GetKeyDown(KeyCode.RightShift))
        {
            if (ScenesVisible == true)
            {
                ScenesVisible = false;
            }
            else
            {
                ScenesVisible = true;
            }
        }

        PrevStartDown = curStartDown;

        return(ScenesVisible);
    }
Esempio n. 2
0
	// GetCurrentLevel
	int GetCurrentLevel()
	{
		bool curHatDown = false;
		if(OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)
			curHatDown = true;
		
		bool curHatUp = false;
		if(OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)
			curHatUp = true;
		
		if((PrevHatDown == false) && (curHatDown == true) ||
			Input.GetKeyDown(KeyCode.DownArrow))
		{
			CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;	
		}
		else if((PrevHatUp == false) && (curHatUp == true) ||
			Input.GetKeyDown(KeyCode.UpArrow))
		{
			CurrentLevel--;	
			if(CurrentLevel < 0)
				CurrentLevel = SceneNames.Length - 1;
		}
					
		PrevHatDown = curHatDown;
		PrevHatUp = curHatUp;
		
		return CurrentLevel;
	}
Esempio n. 3
0
    public override void activate()
    {
        ovrGamepadController = GetComponent <OVRGamepadController>();
        ovrPlayerController  = GetComponent <OVRPlayerController>();

        if (ovrPlayerController == null)
        {
            CLogger.LogError("Fallback to COVRPlayerControllerCoupled failed. Missing OVRGamepadController component.");
            return;
        }
        else
        {
            //Enable OVRPlayerController to support keyboard movement
            ovrPlayerController.enabled = true;
        }

        if (ovrGamepadController == null)
        {
            CLogger.LogWarning("COVRPlayerControllerCoupled is missing OVRGamepadController component.");
        }
        else
        {
            //Enable OVRGamepadController to support gamepad movement
            ovrGamepadController.enabled = true;
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Check input and toggle the debug graph.
    /// See the input mapping setup in the Unity Integration guide.
    /// </summary>
    void Update()
    {
        // NOTE: some of the buttons defined in OVRGamepadController.Button are not available on the Android game pad controller
        if (OVRGamepadController.GPC_GetButtonDown(toggleButton))
        {
            Debug.Log(" TOGGLE GRAPH ");

            //*************************
            // toggle the debug graph .. off -> running -> paused
            //*************************
            switch (debugMode)
            {
            case DebugPerfMode.DEBUG_PERF_OFF:
                debugMode = DebugPerfMode.DEBUG_PERF_RUNNING;
                break;

            case DebugPerfMode.DEBUG_PERF_RUNNING:
                debugMode = DebugPerfMode.DEBUG_PERF_FROZEN;
                break;

            case DebugPerfMode.DEBUG_PERF_FROZEN:
                debugMode = DebugPerfMode.DEBUG_PERF_OFF;
                break;
            }

            // Turn on/off debug graph
            OVRPlugin.debugDisplay = (debugMode != DebugPerfMode.DEBUG_PERF_OFF);
            OVRPlugin.collectPerf  = (debugMode == DebugPerfMode.DEBUG_PERF_FROZEN);
        }
    }
Esempio n. 5
0
    // ShowLevels
    bool ShowLevels()
    {
        if (Scenes.Length == 0)
        {
            sShowLevels = false;
            return(sShowLevels);
        }

        bool curStartDown = false;

        if (OVRGamepadController.GetButtonStart() == true)
        {
            curStartDown = true;
        }

        if ((PrevStartDown == false) && (curStartDown == true) ||
            Input.GetKeyDown(KeyCode.RightShift))
        {
            if (sShowLevels == true)
            {
                sShowLevels = false;
            }
            else
            {
                sShowLevels = true;
            }
        }

        PrevStartDown = curStartDown;

        return(sShowLevels);
    }
Esempio n. 6
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) || OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.Back))
     {
         VR.InputTracking.Recenter();
     }
 }
Esempio n. 7
0
    void OnDisable()
    {
        OVRManager.HMDAcquired -= OnHMDAcquired;
        OVRManager.HMDLost     -= OnHMDLost;

        OVRGamepadController.GPC_Destroy();
    }
    void Update()
    {
        if (fuel < maxFuel)
        {
            fuel = Mathf.Clamp(fuel + Time.deltaTime * fuelReplenishedPerSecond, 0, maxFuel);
        }

        if (flying)
        {
            if ((Input.GetKey(KeyCode.Space) || OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.A)) && fuel > 0)
            {
                fuel -= fuelConsumePerSecond * Time.deltaTime;
                Vector3 moveDir = flightDirection;


                if (playerTransform.position.y < maxHeight)
                {
                    moveDir.y = 1;
                }
                playerTransform.position = playerTransform.position + moveDir * Time.deltaTime * moveSpeed;
            }
            else
            {
                audioSource.Stop();
                flying = false;
            }
        }
        else
        {
            if ((Input.GetKeyDown(KeyCode.Space) || OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.A)) && fuel > 0)
            {
                Audio.PlaySound(jetTakeoff, transform.position);
                audioSource.PlayDelayed(jetTakeoff.length);
                flying            = true;
                flightDirection   = cameraTransform.forward;
                flightDirection.y = 0;
            }
            else
            {
                if (playerTransform.position.y > minHeight)
                {
                    Vector3 moveDir = flightDirection;
                    moveDir.y = -1;

                    playerTransform.position = playerTransform.position + moveDir * Time.deltaTime * moveSpeed;
                    if (playerTransform.position.y <= minHeight)
                    {
                        Audio.PlaySound(jetLand, transform.position);
                    }
                }
            }
        }

        Vector3 finalPos = transform.position;

        finalPos.x = Mathf.Clamp(finalPos.x, -limit.x, limit.x);
        finalPos.z = Mathf.Clamp(finalPos.z, -limit.y, limit.y);

        playerTransform.position = finalPos;
    }
Esempio n. 9
0
    // RIFT RESET ORIENTATION

    // UpdateResetOrientation
    void UpdateResetOrientation()
    {
        if (((sShowLevels == false) && (OVRGamepadController.GetDPadDown() == true)) ||
            (Input.GetKeyDown(KeyCode.B) == true))
        {
            OVRDevice.ResetOrientation(0);
        }
    }
Esempio n. 10
0
    // Update is called once per frame
    void Update()
    {
        bool startPressed = OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Start);

        if (startPressed)
        {
            Application.LoadLevel("SeansRoom");
        }
    }
Esempio n. 11
0
    void OnEnable()
    {
        OVRManager.HMDAcquired += OnHMDAcquired;
        OVRManager.HMDLost     += OnHMDLost;

        OVRGamepadController.GPC_Initialize();

        OVRManager.DismissHSWDisplay();
    }
Esempio n. 12
0
    // RIFT RESET ORIENTATION

    // UpdateResetOrientation
    void UpdateResetOrientation()
    {
        if (((ScenesVisible == false) &&
             (OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)) ||
            (Input.GetKeyDown(KeyCode.B) == true))
        {
            OVRDevice.ResetOrientation(0);
        }
    }
Esempio n. 13
0
 /// <summary>
 /// Check input and reset orientation if necessary
 /// See the input mapping setup in the Unity Integration guide
 /// </summary>
 void Update()
 {
     // NOTE: some of the buttons defined in OVRGamepadController.Button are not available on the Android game pad controller
     if (OVRGamepadController.GPC_GetButtonDown(resetButton))
     {
         //*************************
         // reset orientation
         //*************************
         OVRManager.display.RecenterPose();
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Check input and toggle monoscopic rendering mode if necessary
 /// See the input mapping setup in the Unity Integration guide
 /// </summary>
 void Update()
 {
     // NOTE: some of the buttons defined in OVRGamepadController.Button are not available on the Android game pad controller
     if (OVRGamepadController.GPC_GetButtonDown(toggleButton))
     {
         //*************************
         // toggle monoscopic rendering mode
         //*************************
         monoscopic = !monoscopic;
         OVRManager.instance.monoscopic = monoscopic;
     }
 }
Esempio n. 15
0
    void Awake()
    {
        iTween.CameraFadeAdd(); // add a camera fade texture

        // TURN OFF OVR CHARACTER STUFF
        OVRCharacter         = Player_OVRPC.GetComponent <CharacterController>();
        OVRGamepad           = Player_OVRPC.GetComponent <OVRGamepadController>();
        OVRPlayer            = Player_OVRPC.GetComponent <OVRPlayerController>();
        OVRCharacter.enabled = false;
        OVRGamepad.enabled   = false;
        OVRPlayer.enabled    = false;
    }
 void Update()
 {
     // NOTE: some of the buttons defined in OVRGamepadController.Button are not available on the Android game pad controller
     if (OVRGamepadController.GPC_GetButtonDown(toggleButton))
     {
         //*************************
         // toggle chromatic aberration correction
         //*************************
         chromatic = !chromatic;
         OVRManager.instance.chromatic = chromatic;
     }
 }
Esempio n. 17
0
 void ListenForMenuButtons()
 {
     if (guiObject.TutorialText)
     {
         if (Input.GetKeyDown(KeyCode.T) || OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.A) && guiObject.TutorialText)
         {
             // start game
             guiObject.TutorialText = false;
         }
     }
     else if (guiObject.RestartText)
     {
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Change default vr mode parms dynamically.
 /// </summary>
 void Update()
 {
     // NOTE: some of the buttons defined in OVRGamepadController.Button are not available on the Android game pad controller
     if (OVRGamepadController.GPC_GetButtonDown(resetButton))
     {
         //*************************
         // Dynamically change VrModeParms cpu and gpu level.
         // NOTE: Reset will cause 1 frame of flicker as it leaves
         // and re-enters Vr mode.
         //*************************
         OVRPlugin.cpuLevel = 0;
         OVRPlugin.gpuLevel = 1;
     }
 }
Esempio n. 19
0
    /// <summary>
    /// Static contructor for the OVRInputControl class.
    /// </summary>
    static OVRInputControl()
    {
        Debug.Log("OVRInputControl has been deprecated and will be removed in a future release. Please migrate to OVRInput. "
                  + "Refer to the documentation here for more information: "
                  + "https://developer.oculus.com/documentation/game-engines/latest/concepts/unity-ovrinput/");

#if UNITY_ANDROID && !UNITY_EDITOR
        OVRGamepadController.SetReadAxisDelegate(ReadJoystickAxis);
        OVRGamepadController.SetReadButtonDelegate(ReadJoystickButton);
#endif
        switch (Application.platform)
        {
        case RuntimePlatform.WindowsPlayer:
            Init_Windows();
            break;

        case RuntimePlatform.WindowsEditor:
            Init_Windows_Editor();
            break;

        case RuntimePlatform.Android:
            Init_Android();
            break;

        case RuntimePlatform.OSXPlayer:
            Init_OSX();
            break;

        case RuntimePlatform.OSXEditor:
            Init_OSX_Editor();
            break;

        case RuntimePlatform.IPhonePlayer:
            Init_iPhone();
            break;
        }

        string[] joystickNames = Input.GetJoystickNames();
        for (int i = 0; i < joystickNames.Length; ++i)
        {
            if (verbose)
            {
                Debug.Log("Found joystick '" + joystickNames[i] + "'...");
            }
        }
    }
Esempio n. 20
0
	// UpdateSelectCurrentLevel
	void UpdateSelectCurrentLevel()
	{
		ShowLevels();
				
		if(ScenesVisible == false)
			return;
			
		CurrentLevel = GetCurrentLevel();
		
		if((Scenes.Length != 0) && 
		   ((OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.A) == true) ||
			 Input.GetKeyDown(KeyCode.Return)))
		{
			LoadingLevel = true;
			Application.LoadLevelAsync(Scenes[CurrentLevel]);
		}
	}
Esempio n. 21
0
    // UpdateSelectCurrentLevel
    void UpdateSelectCurrentLevel()
    {
        ShowLevels();

        if (sShowLevels == false)
        {
            return;
        }

        CurrentLevel = GetCurrentLevel();

        if ((Scenes.Length != 0) &&
            ((OVRGamepadController.GetButtonA() == true) ||
             Input.GetKeyDown(KeyCode.Return)))
        {
            Application.LoadLevel(Scenes[CurrentLevel]);
        }
    }
Esempio n. 22
0
    // Update is called once per frame
    void Update()
    {
        LineRenderer lineRender;
        RaycastHit   hit;

        bool yPressed = OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Y);

        if (yPressed)
        {
            if (Physics.Raycast(player.transform.position, player.transform.forward, out hit))
            {
                // Draw a line to show the player where they are aiming
                lineRender         = (LineRenderer)line.renderer;
                lineRender.enabled = true;

                lineRender.SetPosition(0, player.transform.position - new Vector3(0.0f, 0.3f, 0.0f));
                lineRender.SetPosition(1, hit.point);
            }
        }
        else if (!yPressed && previousYPressed)
        {
            if (Physics.Raycast(player.transform.position, player.transform.forward, out hit))
            {
                // Create the explosion's particle effect
                Instantiate(explosion, hit.point, Quaternion.identity);

                // Create an explosion around where the player aims
                Collider[] colliders = Physics.OverlapSphere(hit.point, radius);

                foreach (Collider collider in colliders)
                {
                    if (collider.rigidbody == null)
                    {
                        continue;
                    }
                    collider.rigidbody.AddExplosionForce(force, hit.point, radius, 0.0f, ForceMode.Impulse);
                }
            }
            line.renderer.enabled = false;
        }

        previousYPressed = yPressed;
    }
Esempio n. 23
0
    // Update is called once per frame
    void Update()
    {
        if (OVRGamepadController.GPC_GetButton(0) || Input.GetKey(KeyCode.E))
        {
            RaycastHit hit;
            Ray        rayFired = new Ray(transform.FindChild("OVRCameraController").FindChild("CameraLeft").position +
                                          (transform.FindChild("OVRCameraController").FindChild("CameraLeft").forward *3.0f),
                                          transform.FindChild("OVRCameraController").FindChild("CameraLeft").forward);

            if (Physics.Raycast(rayFired, out hit, pokeDistance))
            {
                if (hit.collider.tag == "user")
                {
                    string id = hit.collider.GetComponentInParent <OVRPlayerController>().GetComponent <PlayerInfo>().id;
                    StartCoroutine(Poker(id));
                }
            }
        }
    }
Esempio n. 24
0
    /// <summary>
    /// Static contructor for the OVRInputControl class.
    /// </summary>
    static OVRInputControl()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        OVRGamepadController.SetReadAxisDelegate(ReadJoystickAxis);
        OVRGamepadController.SetReadButtonDelegate(ReadJoystickButton);
#endif
        switch (Application.platform)
        {
        case RuntimePlatform.WindowsPlayer:
            Init_Windows();
            break;

        case RuntimePlatform.WindowsEditor:
            Init_Windows_Editor();
            break;

        case RuntimePlatform.Android:
            Init_Android();
            break;

        case RuntimePlatform.OSXPlayer:
            Init_OSX();
            break;

        case RuntimePlatform.OSXEditor:
            Init_OSX_Editor();
            break;

        case RuntimePlatform.IPhonePlayer:
            Init_iPhone();
            break;
        }

        string[] joystickNames = Input.GetJoystickNames();
        for (int i = 0; i < joystickNames.Length; ++i)
        {
            if (verbose)
            {
                Debug.Log("Found joystick '" + joystickNames[i] + "'...");
            }
        }
    }
Esempio n. 25
0
        /// <summary>
        /// Get extra scroll delta from gamepad
        /// </summary>
        protected Vector2 GetExtraScrollDelta()
        {
            Vector2 scrollDelta = new Vector2();

            if (useLeftStickScroll)
            {
                float x = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftXAxis);
                float y = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftYAxis);
                if (Mathf.Abs(x) < leftStickDeadZone)
                {
                    x = 0;
                }
                if (Mathf.Abs(y) < leftStickDeadZone)
                {
                    y = 0;
                }
                scrollDelta = new Vector2(x, y);
            }
            return(scrollDelta);
        }
Esempio n. 26
0
    // Update is called once per frame
    void Update()
    {
        if (AllowMovement)
        {
            float gamePad_FwdAxis    = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftYAxis);
            float gamePad_StrafeAxis = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftXAxis);

            Vector3 fwdMove    = (CameraRig.centerEyeAnchor.rotation * Vector3.forward) * gamePad_FwdAxis * Time.deltaTime * ForwardSpeed;
            Vector3 strafeMove = (CameraRig.centerEyeAnchor.rotation * Vector3.right) * gamePad_StrafeAxis * Time.deltaTime * StrafeSpeed;
            transform.position += fwdMove + strafeMove;
        }

        if (!UnityEngine.XR.XRDevice.isPresent && (AllowYawLook || AllowPitchLook))
        {
            Quaternion r = transform.rotation;
            if (AllowYawLook)
            {
                float      gamePadYaw = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.RightXAxis);
                float      yawAmount  = gamePadYaw * Time.deltaTime * GamePad_YawDegreesPerSec;
                Quaternion yawRot     = Quaternion.AngleAxis(yawAmount, Vector3.up);
                r = yawRot * r;
            }
            if (AllowPitchLook)
            {
                float gamePadPitch = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.RightYAxis);
                if (Mathf.Abs(gamePadPitch) > 0.0001f)
                {
                    if (InvertPitch)
                    {
                        gamePadPitch *= -1.0f;
                    }
                    float      pitchAmount = gamePadPitch * Time.deltaTime * GamePad_PitchDegreesPerSec;
                    Quaternion pitchRot    = Quaternion.AngleAxis(pitchAmount, Vector3.left);
                    r = r * pitchRot;
                }
            }

            transform.rotation = r;
        }
    }
Esempio n. 27
0
    void ListenToWeaponCycle()
    {
        WeaponMgr.WeaponType type = WeaponMgr.ACTIVE_WEAPON.GetWeaponType();

        if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.LeftShoulder))
        {
            Debug.Log("CYCLE LEFT WPN");
            // cycle weapon left
            if (type > 0)
            {
                WeaponMgr.ChangeWeapon(type - 1);
            }
        }
        else if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.RightShoulder))
        {
            Debug.Log("CYCLE RIGHT WPN");
            // cycle weapon right
            if (type < (WeaponMgr.WeaponType.WEAPON_COUNT - 1))
            {
                WeaponMgr.ChangeWeapon(type + 1);
            }
        }
    }
Esempio n. 28
0
    void Update()
    {
        shotLimit = WeaponMgr.ACTIVE_WEAPON.FireRate;

        if (!m_oculusConnected)
        {
            SetupMouseLookat();
        }

        // skip tutorial, restart etc.
        ListenForMenuButtons();
        // previous, next weapon
        ListenToWeaponCycle();

        CycleWeapons();

        // TODO: also check if 0, then reset timer
        if (Input.GetMouseButtonDown(0) || Mathf.Abs(OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.RightTrigger)) > 0 || Input.GetMouseButton(0))
        {
            // shoot and other stuff
            if (m_timeSinceShot <= shotLimit)
            {
                m_timeSinceShot += Time.deltaTime * 1000.0f; // add time in ms
                return;
            }
            else
            {
                m_timeSinceShot = 0;
                Shoot();
            }
        }

        if (Input.GetKeyDown(KeyCode.R) || OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.B))
        {
            Application.LoadLevel(Application.loadedLevelName);
        }
    }
Esempio n. 29
0
        /// <summary>
        /// Get state of button corresponding to gaze pointer
        /// </summary>
        /// <returns></returns>
        protected PointerEventData.FramePressState GetGazeButtonState()
        {
            var pressed  = Input.GetKeyDown(gazeClickKey) || OVRGamepadController.GPC_GetButtonDown(joyPadClickButton);
            var released = Input.GetKeyUp(gazeClickKey) || OVRGamepadController.GPC_GetButtonUp(joyPadClickButton);

#if UNITY_ANDROID && !UNITY_EDITOR
            pressed  |= Input.GetMouseButtonDown(0);
            released |= Input.GetMouseButtonUp(0);
#endif

            if (pressed && released)
            {
                return(PointerEventData.FramePressState.PressedAndReleased);
            }
            if (pressed)
            {
                return(PointerEventData.FramePressState.Pressed);
            }
            if (released)
            {
                return(PointerEventData.FramePressState.Released);
            }
            return(PointerEventData.FramePressState.NotChanged);
        }
Esempio n. 30
0
    // GetCurrentLevel
    int GetCurrentLevel()
    {
        bool curHatDown = false;

        if (OVRGamepadController.GetDPadDown() == true)
        {
            curHatDown = true;
        }

        bool curHatUp = false;

        if (OVRGamepadController.GetDPadDown() == true)
        {
            curHatUp = true;
        }

        if ((PrevHatDown == false) && (curHatDown == true) ||
            Input.GetKeyDown(KeyCode.DownArrow))
        {
            CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;
        }
        else if ((PrevHatUp == false) && (curHatUp == true) ||
                 Input.GetKeyDown(KeyCode.UpArrow))
        {
            CurrentLevel--;
            if (CurrentLevel < 0)
            {
                CurrentLevel = SceneNames.Length - 1;
            }
        }

        PrevHatDown = curHatDown;
        PrevHatUp   = curHatUp;

        return(CurrentLevel);
    }
Esempio n. 31
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// Returns the current value of the specified joystick axis.
	/// </summary>
	public static float GetJoystickAxis(int joystickNumber, OVRGamepadController.Axis axis)
	{
		string platformName = platformPrefix + "Joy " + joystickNumber + ":" + OVRGamepadController.AxisNames[(int)axis];
		return Input.GetAxis(platformName);
	}
Esempio n. 32
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// This only exists for legacy compatibility with OVRGamepadController.
	/// </summary>
	public static float ReadJoystickAxis(OVRGamepadController.Axis axis)
	{
		//OVRDebugUtils.Print("OVRInputControl.ReadJoystickAxis");
		return GetJoystickAxis(1, axis);
	}
Esempio n. 33
0
		/// <summary>
		/// Joystick axis constructor.
		/// </summary>
		public KeyInfo(
				DeviceType inDeviceType,
				OVRGamepadController.Axis inJoystickAxis,
				OnKeyDown inDownHandler,
				OnKeyHeld inHeldHandler,
				OnKeyUp inUpHandler)
		{
			deviceType = inDeviceType;
			keyName = OVRGamepadController.AxisNames[(int)inJoystickAxis];
			mouseButton = MouseButton.None;
			joystickButton = OVRGamepadController.Button.None;
			joystickAxis = inJoystickAxis;
			threshold = 0.5f;
			wasDown = false;
			downHandler = inDownHandler;
			heldHandler = inHeldHandler;
			upHandler = inUpHandler;
		}
Esempio n. 34
0
	/// <summary>
	/// Adds a handler for joystick axis input.
	/// </summary>
	public static void AddInputHandler(
			DeviceType dt,
		   	OVRGamepadController.Axis axis,
			OnKeyDown onDown,
		   	OnKeyHeld onHeld,
		   	OnKeyUp onUp)
	{
		keyInfos.Add(new KeyInfo(dt, axis, onDown, onHeld, onUp));
	}
Esempio n. 35
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// This only exists for legacy compatibility with OVRGamepadController.
	/// </summary>
	public static bool ReadJoystickButton(OVRGamepadController.Button button)
	{
		//if (verbose)
			//Debug.Log("OVRInputControl.ReadJoystickButton");
		return GetJoystickButton(1, button);
	}
Esempio n. 36
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// This only exists for legacy compatibility with OVRGamepadController.
	/// </summary>
	public static float ReadJoystickAxis(OVRGamepadController.Axis axis)
	{
		//if (verbose)
			//Debug.Log("OVRInputControl.ReadJoystickAxis");
		return GetJoystickAxis(1, axis);
	}
Esempio n. 37
0
        // joystick axis constructor
        public KeyInfo( eDeviceType inDeviceType, 
						OVRGamepadController.Axis inJoystickAxis,
						OnKeyDown inDownHandler, 
						OnKeyHeld inHeldHandler, 
						OnKeyUp inUpHandler )
        {
            DeviceType = inDeviceType;
                    KeyName = OVRGamepadController.AxisNames[(int)inJoystickAxis];
                    MouseButton = eMouseButton.None;
                    JoystickButton = OVRGamepadController.Button.None;
                    JoystickAxis = inJoystickAxis;
                    Threshold = 0.5f;
                    WasDown = false;
                    DownHandler = inDownHandler;
                    HeldHandler = inHeldHandler;
                    UpHandler = inUpHandler;
        }
Esempio n. 38
0
 void Awake()
 {
     iTween.CameraFadeAdd(); // add a camera fade texture
     
     // TURN OFF OVR CHARACTER STUFF
     OVRCharacter = Player_OVRPC.GetComponent<CharacterController>();        
     OVRGamepad = Player_OVRPC.GetComponent<OVRGamepadController>();        
     OVRPlayer = Player_OVRPC.GetComponent<OVRPlayerController>();
     OVRCharacter.enabled = false;
     OVRGamepad.enabled = false;
     OVRPlayer.enabled = false;
 }
Esempio n. 39
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// Returns true if the specified joystick button is pressed.
	/// </summary>
	public static bool GetJoystickButton(int joystickNumber, OVRGamepadController.Button button)
	{
		string fullName = platformPrefix + "Joy " + joystickNumber + ":" + OVRGamepadController.ButtonNames[(int)button];
		//OVRDebugUtils.Print("Checking button " + fullName);
		return Input.GetButton(fullName);
	}
Esempio n. 40
0
	/// <summary>
	/// Delegate for OVRGamepadController.
	/// This only exists for legacy compatibility with OVRGamepadController.
	/// </summary>
	public static bool ReadJoystickButton(OVRGamepadController.Button button)
	{
		//OVRDebugUtils.Print("OVRInputControl.ReadJoystickButton");
		return GetJoystickButton(1, button);
	}
Esempio n. 41
0
    //======================
    // AddInputHandler
    // Adds a hander for joystick button input
    //======================
    public static void AddInputHandler( eDeviceType dt, OVRGamepadController.Button joystickButton,
			OnKeyDown onDown, OnKeyHeld onHeld, OnKeyUp onUp )
    {
        KeyInfos.Add( new KeyInfo( dt, joystickButton, onDown, onHeld, onUp ) );
    }