public void Update() { if (Input.GetMouseButtonDown(0)) { _selectedAxis = CheckSelectedAxis(); } if (Input.GetMouseButtonUp(0)) { _selectedAxis = AxisDirections.None; _gizmoIsTracking = false; _gizmoRayOffset = 0f; _gizmoPosAtStart = Vector3.Zero; } if (_selectedAxis != AxisDirections.None) { switch (_selectedAxis) { case AxisDirections.X: HandleXAxisMovement(); break; case AxisDirections.Y: HandleYAxisMovement(); break; case AxisDirections.Z: HandleZAxisMovement(); break; } } //DebugRenderer.DrawLine(Vector3.Zero, new Vector3(0, 0, 500), Color.White); DrawGizmoDebugLines(); }
public static bool IsDpadHeld(AxisDirections direction) { bool pressed; switch (direction) { case AxisDirections.Up: pressed = currentState.IsButtonDown(Buttons.DPadUp); break; case AxisDirections.Down: pressed = currentState.IsButtonDown(Buttons.DPadDown); break; case AxisDirections.Left: pressed = currentState.IsButtonDown(Buttons.DPadLeft); break; default: pressed = currentState.IsButtonDown(Buttons.DPadRight); break; } return(pressed && Pigeon.IsInFocus); }
/// <summary> /// Instantiate new KeyBindingValue /// </summary> /// <param name="keyCode">Corresponds to the key code of the input. See <seealso cref="KeyCode"/> for more info.</param> /// <param name="axisDirection"></param> /// <param name="readAsAxis"></param> /// <param name="deadZone"></param> public KeyCodeValue(string keyCode, AxisDirections axisDirection = AxisDirections.Positive, bool readAsAxis = false, float deadZone = 0.19f) { KeyCode = keyCode; AxisDirection = axisDirection; ReadAsAxis = readAsAxis; DeadZone = deadZone; }
/// <summary> /// Returns the UV co-ordinates for the block type. /// </summary> /// <param name="face">The face to return the co-ordinates for.</param> /// <param name="textureSize">Side length of the texture file containing the block textures.</param> /// <returns>An array of vectors representing the UV co-ordinates of the four corners, clockwise from the bottom-left.</returns> public Vector2[] GetUvCoordinates(AxisDirections face) { Rectangle textureRect; Vector2[] uvCoords = new Vector2[4]; float top, left, bottom, right; // UV co-ordinates of the sides of the texture region switch (face) { // Top case AxisDirections.YPositive: textureRect = topTextureRect; break; // Bottom case AxisDirections.YNegative: textureRect = bottomTextureRect; break; // Sides case AxisDirections.XNegative: // Fall through case AxisDirections.XPositive: // Fall through case AxisDirections.ZNegative: // Fall through case AxisDirections.ZPositive: textureRect = sideTextureRect; break; default: throw new ArgumentException("Argument must be a single side."); } top = (float)textureRect.Top / (float)GameSettings.BLOCK_ATLAS_HEIGHT; left = (float)textureRect.Left / (float)GameSettings.BLOCK_ATLAS_WIDTH; bottom = (float)textureRect.Bottom / (float)GameSettings.BLOCK_ATLAS_HEIGHT; right = (float)textureRect.Right / (float)GameSettings.BLOCK_ATLAS_WIDTH; uvCoords[0] = new Vector2(left, bottom); uvCoords[1] = new Vector2(left, top); uvCoords[2] = new Vector2(right, top); uvCoords[3] = new Vector2(right, bottom); return(uvCoords); }
public static bool IsLeftJoystickPressed(AxisDirections dir) { switch (dir) { case AxisDirections.Up: return(IsLeftJoystickPressedUp()); case AxisDirections.Down: return(IsLeftJoystickPressedDown()); case AxisDirections.Left: return(IsLeftJoystickPressedLeft()); default: return(IsLeftJoystickPressedRight()); } }
public bool IsLJSHeld(AxisDirections direction) { switch (direction) { case AxisDirections.Up: return(RawGamepadInput.IsLeftJoystickHeldUp()); case AxisDirections.Down: return(RawGamepadInput.IsLeftJoystickHeldDown()); case AxisDirections.Left: return(RawGamepadInput.IsLeftJoystickHeldLeft()); default: return(RawGamepadInput.IsLeftJoystickHeldRight()); } }
public bool IsHeld(AxisDirections dir) { switch (dir) { case AxisDirections.Up: return(RawKeyboardInput.IsHeld(Keys.Up)); case AxisDirections.Down: return(RawKeyboardInput.IsHeld(Keys.Down)); case AxisDirections.Left: return(RawKeyboardInput.IsHeld(Keys.Left)); default: return(RawKeyboardInput.IsHeld(Keys.Right)); } }
public static AxisDirections Opposite(this AxisDirections sd) { switch (sd) { case AxisDirections.Up: return(AxisDirections.Down); case AxisDirections.Down: return(AxisDirections.Up); case AxisDirections.Left: return(AxisDirections.Right); case AxisDirections.Right: return(AxisDirections.Left); default: throw new ArgumentOutOfRangeException(nameof(sd)); } }
/// <summary> /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.Core.Axis"/> class. /// </summary> /// <param name="vxEngine">Vx engine.</param> /// <param name="ParentCursor">Parent cursor.</param> /// <param name="AxisDirections">Axis directions.</param> public vxAxisRotator(vxEngine vxEngine, vxCursor3D ParentCursor, AxisDirections AxisDirections) : base(vxEngine, null, Vector3.Zero) { model = vxEngine.Assets.Models.UnitTorus.ModelMain; this.ParentCursor = ParentCursor; DoShadowMap = false; HitBox = new Cylinder(Vector3.Zero, 2, 25); World = Matrix.CreateScale(2, 2, 25); this.AxisDirections = AxisDirections; switch (AxisDirections) { case AxisDirections.X: PlainColor = new Color(128, 0, 0); World = Matrix.CreateScale(25, 2, 2); break; case AxisDirections.Y: PlainColor = Color.Green; World = Matrix.CreateScale(2, 25, 2); break; case AxisDirections.Z: PlainColor = new Color(0, 0, 128); World = Matrix.CreateScale(2, 2, 25); break; } Current3DScene.BEPUPhyicsSpace.Add(HitBox); // Current3DScene.BEPUDebugDrawer.Add(HitBox); HitBox.CollisionInformation.Tag = AxisDirections; HitBox.CollisionInformation.CollisionRules.Personal = Virtex.Lib.Vrtc.Physics.BEPU.CollisionRuleManagement.CollisionRule.NoSolver; //Remove from the main list so that it can be drawn over the entire scene //Current3DScene.List_Entities.Remove(this); //Current3DScene.List_OverlayItems.Add(this); }
public bool IsDpadHeld(AxisDirections direction) { return(RawGamepadInput.IsDpadHeld(direction)); }
/// <summary> /// Used when rebuilding geometry, this function sets the given face as being hidden, /// i.e. facing an opaque block. /// </summary> /// <param name="face"></param> public void SetFaceHidden(AxisDirections face) { VisibleFaces &= 255 - face; }
/// <summary> /// Used when rebuilding geometry, this function sets the given face as being visible, /// i.e. facing a transparent block. /// </summary> /// <param name="face"></param> public void SetFaceVisible(AxisDirections face) { VisibleFaces |= face; }
public static Point ToPoint(this AxisDirections axisDir) { return(points[(int)axisDir]); }
public static int ToInt(this AxisDirections axisDir) { return((int)axisDir); }