Пример #1
0
	private static bool GetResolvedNearTouchUp(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask)
	{
		bool up = false;

		if ((controllerMask & Controller.Active) != 0)
			controllerMask |= activeControllerType;

		for (int i = 0; i < controllers.Count; i++)
		{
			OVRControllerBase controller = controllers[i];

			if (ShouldResolveController(controller.controllerType, controllerMask))
			{
				RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask);

				if (((RawNearTouch)controller.currentState.NearTouches & resolvedMask) != 0)
				{
					return false;
				}

				if ((((RawNearTouch)controller.currentState.NearTouches & resolvedMask) == 0)
					&& (((RawNearTouch)controller.previousState.NearTouches & resolvedMask) != 0))
				{
					up = true;
				}
			}
		}

		return up;
	}
Пример #2
0
		public RawNearTouch ResolveToRawMask(NearTouch virtualMask)
		{
			return nearTouchMap.ToRawMask(virtualMask);
		}
Пример #3
0
	/// <summary>
	/// Gets the current up state of the given virtual near touch mask with the given controller mask.
	/// Returns true if any masked near touch was released this frame on any masked controller and no other masked near touch is still down this frame.
	/// </summary>
	public static bool GetUp(NearTouch virtualMask, Controller controllerMask = Controller.Active)
	{
		return GetResolvedNearTouchUp(virtualMask, RawNearTouch.None, controllerMask);
	}
Пример #4
0
    private bool GetResolvedNearTouchDown(NearTouch virtualMask, RawNearTouch rawMask, ControllerType controllerMask)
    {
        if (!OVRManager.instance.isVRPresent)
            return false;

        bool down = false;

        if ((controllerMask & ControllerType.Active) != 0)
            controllerMask |= activeControllerType;

        for (int i = 0; i < controllers.Count; i++)
        {
            OVRControllerBase controller = controllers[i];

            if (ShouldResolveController(controller.controllerType, controllerMask))
            {
                RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask);

                if (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) != 0)
                {
                    return false;
                }

                if ((((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0)
                    && (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) == 0))
                {
                    down = true;
                }
            }
        }

        return down;
    }
Пример #5
0
			public RawNearTouch ToRawMask(NearTouch virtualMask)
			{
				RawNearTouch rawMask = 0;

				if (virtualMask == NearTouch.None)
					return RawNearTouch.None;

				if ((virtualMask & NearTouch.PrimaryIndexTrigger) != 0)
					rawMask |= PrimaryIndexTrigger;
				if ((virtualMask & NearTouch.PrimaryThumbButtons) != 0)
					rawMask |= PrimaryThumbButtons;
				if ((virtualMask & NearTouch.SecondaryIndexTrigger) != 0)
					rawMask |= SecondaryIndexTrigger;
				if ((virtualMask & NearTouch.SecondaryThumbButtons) != 0)
					rawMask |= SecondaryThumbButtons;

				return rawMask;
			}
Пример #6
0
 /// <summary>
 /// Gets the current up state of the given virtual near touch mask with the given controller mask.
 /// Returns true if any masked near touch was released this frame on any masked controller and no other masked near touch is still down this frame.
 /// </summary>
 public static bool GetUp(NearTouch virtualMask, ControllerType controllerMask)
 {
     return OVRManager.input.GetResolvedNearTouchUp(virtualMask, RawNearTouch.None, controllerMask);
 }
Пример #7
0
 /// <summary>
 /// Gets the current down state of the given virtual near touch mask with the Active controller.
 /// Returns true if any masked near touch was pressed this frame on the Active controller and no masked near touch was previously down last frame.
 /// </summary>
 public static bool GetDown(NearTouch virtualMask)
 {
     return OVRManager.input.GetResolvedNearTouchDown(virtualMask, RawNearTouch.None, ControllerType.Active);
 }
Пример #8
0
	private bool GetResolvedNearTouch(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask)
	{
		if (!OVRManager.isHmdPresent)
			return false;

		if ((controllerMask & Controller.Active) != 0)
			controllerMask |= activeControllerType;

		for (int i = 0; i < controllers.Count; i++)
		{
			OVRControllerBase controller = controllers[i];

			if (ShouldResolveController(controller.controllerType, controllerMask))
			{
				RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask);

				if (((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0)
				{
					return true;
				}
			}
		}

		return false;
	}
Пример #9
0
	private bool GetResolvedNearTouchUp(NearTouch virtualMask, RawNearTouch rawMask, Controller controllerMask)
	{
#if OVR_LEGACY
		if (!OVRManager.instance.isVRPresent)
			return false;
#else
		if (!OVRManager.isHmdPresent)
			return false;
#endif

		bool up = false;

		if ((controllerMask & Controller.Active) != 0)
			controllerMask |= activeControllerType;

		for (int i = 0; i < controllers.Count; i++)
		{
			OVRControllerBase controller = controllers[i];

			if (ShouldResolveController(controller.controllerType, controllerMask))
			{
				RawNearTouch resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask);

				if (((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) != 0)
				{
					return false;
				}

				if ((((RawNearTouch)controller.currentInputState.NearTouches & resolvedMask) == 0)
					&& (((RawNearTouch)controller.previousInputState.NearTouches & resolvedMask) != 0))
				{
					up = true;
				}
			}
		}

		return up;
	}
Пример #10
0
	/// <summary>
	/// Gets the current state of the given virtual near touch mask with the given controller mask.
	/// Returns true if any masked near touch is down on any masked controller.
	/// </summary>
	public static bool Get(NearTouch virtualMask, Controller controllerMask = Controller.Active)
	{
		return OVRManager.input.GetResolvedNearTouch(virtualMask, RawNearTouch.None, controllerMask);
	}