public static void checkInput(UiGrid passedGrid, InputMngr inputMngr) { if (inputMngr.checkInput(controls.pressEnter)) { UIObj activeObject = passedGrid.getSelObject(); activeObject.runInstruction(); } if (inputMngr.checkInput(controls.pressUp)) { passedGrid.updateGridPos(UiGrid.direction.up); } if (inputMngr.checkInput(controls.pressLeft)) { passedGrid.updateGridPos(UiGrid.direction.left); } if (inputMngr.checkInput(controls.pressDown)) { passedGrid.updateGridPos(UiGrid.direction.down); } if (inputMngr.checkInput(controls.pressRight)) { passedGrid.updateGridPos(UiGrid.direction.right); } passedGrid.updateSelected(); }
public override void Update(InputMngr inputMngr) { if (fcb.charSphere.Intersects(fallingBox) == true) { } else if (fcb.charSphere.Intersects(floor) == true) { } else { fcb.move(new Vector3(0, -0.01f, 0)); } //Need to make a generic player input checking system. if (inputMngr.getInputState() == InputMngr.InputState.playerKbrd) { if (inputMngr.checkInput(controls.holdRight)) { fcb.move(new Vector3(-0.1f, 0, 0)); } if (inputMngr.checkInput(controls.holdLeft)) { fcb.move(new Vector3(0.1f, 0, 0)); } if (inputMngr.checkInput(controls.pressJump)) { fcb.move(new Vector3(0, 1f, 0)); } if (inputMngr.checkInput(controls.debug)) { inputMngr.changeInputState(InputMngr.InputState.debugKbrd); } } //Taken from Triangle class need to make proper else if (inputMngr.getInputState().Equals(InputMngr.InputState.debugKbrd)) { //Basic Hori and Vert if (Keyboard.GetState().IsKeyDown(Keys.A)) { SpaceMngr.camPosition.X -= 0.1f; SpaceMngr.camTarget.X -= 0.1f; } if (Keyboard.GetState().IsKeyDown(Keys.D)) { SpaceMngr.camPosition.X += 0.1f; SpaceMngr.camTarget.X += 0.1f; } if (Keyboard.GetState().IsKeyDown(Keys.W)) { SpaceMngr.camPosition.Y -= 0.1f; SpaceMngr.camTarget.Y -= 0.1f; } if (Keyboard.GetState().IsKeyDown(Keys.S)) { SpaceMngr.camPosition.Y += 0.1f; SpaceMngr.camTarget.Y += 0.1f; } //Rotation if (Keyboard.GetState().IsKeyDown(Keys.Right)) { Matrix rotationMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(0.1f)); SpaceMngr.camPosition = Vector3.Transform(SpaceMngr.camPosition, rotationMatrix); } if (Keyboard.GetState().IsKeyDown(Keys.Left)) { Matrix rotationMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(-0.1f)); SpaceMngr.camPosition = Vector3.Transform(SpaceMngr.camPosition, rotationMatrix); } if (Keyboard.GetState().IsKeyDown(Keys.Up)) { Matrix rotationMatrix = Matrix.CreateRotationX(MathHelper.ToRadians(0.1f)); SpaceMngr.camPosition = Vector3.Transform(SpaceMngr.camPosition, rotationMatrix); } if (Keyboard.GetState().IsKeyDown(Keys.Down)) { Matrix rotationMatrix = Matrix.CreateRotationX(MathHelper.ToRadians(-0.1f)); SpaceMngr.camPosition = Vector3.Transform(SpaceMngr.camPosition, rotationMatrix); } //Zoom if (Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { SpaceMngr.camPosition.Z += 0.1f; SpaceMngr.camTarget.Z += 0.1f; } if (Keyboard.GetState().IsKeyDown(Keys.LeftControl)) { SpaceMngr.camPosition.Z -= 0.1f; SpaceMngr.camTarget.Z -= 0.1f; } SpaceMngr.view = Matrix.CreateLookAt(SpaceMngr.camPosition, SpaceMngr.camTarget, Vector3.Up); if (inputMngr.checkInput(controls.debug)) { inputMngr.changeInputState(InputMngr.InputState.playerKbrd); } if (inputMngr.checkInput(controls.pressBack)) { toogleBillboard(); } if (inputMngr.checkInput(controls.pressEnter)) { toogleBoundingShapes(); } spaceMngr.camera.Update(deltaTime); spaceMngr.spacetest.Update(); } }
public override void Update(InputMngr inputMngr) { switch (currentFocus) { case focus.profileCheck: { if (profileMngr.getProfileNum() > 0) { currentFocus = focus.profileSel; break; } if (ProfileMngr.currentProfile == null) { if (firstPass == true) { setProfileCheckUI(); } UiMngr.checkInput(gridOne, inputMngr); } else { throw new Exception("Something went wrong with the profile manager."); } } break; case focus.profileSel: { if (firstPass == true) { setProfileSelUI(); setProfileSelListUI(); } switch (subCurrentFocus) { case subFocus.profileSel: { UiMngr.checkInput(gridOne, inputMngr); if (inputMngr.checkInput(controls.goTestTri) == true) { stateMngr.setCRTState(States.StateMngr.ARstate.AR_Launch, assetMngr); } if (inputMngr.checkInput(controls.pressEnd) == true) { display.changeDisplay(); } } break; case subFocus.profileSelList: { UiMngr.checkInput(gridProfileSel, inputMngr); if (inputMngr.checkInput(controls.pressBack) == true) { subCurrentFocus = subFocus.profileSel; } } break; } } break; case focus.osti: { OSTI.Update(inputMngr); if (OSTI.getDone() == true) { profileName = OSTI.getText(); OSTI.setActive(false); if (profileMngr.checkForProfile(profileName) == false) { profileMngr.createProfile(profileName); currentFocus = focus.profileSel; } else { Console.WriteLine("Profile Already Exists."); OSTI = new OnScreenTextInput(); OSTI.setActive(true); } } } break; } }