/// <summary> /// Whether the indicated wand button was released during this frame. /// </summary> /// <param name="button">The wand button to check.</param> /// <param name="targetWand">Unless specified, the state of the dominant-hand wand is returned.</param> /// <returns>Returns true if the button was released this frame.</returns> public static bool GetButtonUp(WandButton button, WandTarget targetWand = WandTarget.Primary) { var wandState = currentWandStates[targetWand]; var previousWandState = previousWandStates[targetWand]; // Return true if the button is currently released, but was pressed on the previous frame. return(!wandState.GetButtonState(button) && previousWandState.GetButtonState(button)); }
/// <summary> /// Gets the analog value for the trigger, from 0.0 (released) to 1.0 (fully depressed). /// </summary> /// <param name="targetWand"></param> public static float GetTrigger(WandTarget targetWand = WandTarget.Primary) { return(currentWandStates[targetWand].Trigger); }
/// <summary> /// Gets the direction and magnitude of the stick's tilt for the indicated wand. /// </summary> /// <param name="targetWand"></param> public static Vector2 GetStickAxis(WandTarget targetWand = WandTarget.Primary) { return(currentWandStates[targetWand].Stick); }
/// <summary> /// Whether the indicated wand button is currently being pressed. /// </summary> /// <param name="button">The wand button to check.</param> /// <param name="targetWand">Unless specified, the state of the dominant-hand wand is returned.</param> /// <returns>Returns true if the button is being pressed.</returns> public static bool GetButton(WandButton button, WandTarget targetWand = WandTarget.Primary) { var wandState = currentWandStates[targetWand]; return(wandState.GetButtonState(button)); }