private void EvaluateMouseCamControls(GameTime gameTime) { mouseCamera.Slow = input.EvaluateInputBinding("SlowCamera"); if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } if (!releaseMouse) { mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); input.CenterMouse(); } }
public override void Update(GameTime gameTime) { if (!SystemCore.CursorVisible) { if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } if (!releaseMouse) { mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); input.CenterMouse(); } } if (input.EvaluateInputBinding("MainMenu")) { SystemCore.ScreenManager.AddAndSetActive(new MainMenuScreen()); } //DiffuseLight light = SystemCore.ActiveScene.LightsInScene[0] as DiffuseLight; //light.LightDirection = Vector3.Transform(light.LightDirection, Matrix.CreateRotationY(0.001f)); List <GameObject> activeGameObjects = SystemCore.GetSubsystem <GameObjectManager>().GetAllObjects(); BoundingBox testVolume = new BoundingBox(new Vector3(-100, -100, -100), new Vector3(100, 100, 100)); foreach (GameObject activeGameObject in activeGameObjects) { if (testVolume.Contains(activeGameObject.Transform.AbsoluteTransform.Translation) == ContainmentType.Disjoint) { activeGameObject.Transform.SetPosition(-activeGameObject.Transform.AbsoluteTransform.Translation); } } var particleSystem = crate.GetComponent <SquareParticleSystem>(); if (particleSystem != null) { particleSystem.AddParticle(crate.Transform.AbsoluteTransform.Translation, Vector3.Up); } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (!SystemCore.CursorVisible) { mouseCamera.Slow = input.EvaluateInputBinding("SlowCamera"); if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } if (!releaseMouse) { mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); input.CenterMouse(); } } if (input.EvaluateInputBinding("MainMenu")) { SystemCore.ScreenManager.AddAndSetActive(new MainMenuScreen()); } simulationTickTimer.Update(gameTime); MoveCamera(); if (input.MouseLeftPress() && !SystemCore.GUIManager.MouseOverGUIElement) { RayCastResult result; if (SystemCore.PhysicsSimulation.RayCast(input.GetBepuProjectedMouseRay(), out result)) { GameObject parent = result.HitObject.Tag as GameObject; parent.GetComponent <GameOfLifeComponent>().FlipState(); } } SystemCore.ActiveScene.UpdateBackandFillLights(cameraGameObject.Transform.AbsoluteTransform.Forward, cameraGameObject.Transform.AbsoluteTransform.Right); base.Update(gameTime); }
private void EvaluateMouseCamControls(GameTime gameTime) { if (SystemCore.ActiveCamera is MouseFreeCamera) { mouseCamera.Slow = input.EvaluateInputBinding("SlowCamera"); if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } if (input.IsKeyDown(Keys.RightShift)) { mouseCamera.moveSpeed = 10f; } else if (input.IsKeyDown(Keys.RightControl)) { mouseCamera.moveSpeed = 0.1f; } else { mouseCamera.moveSpeed = 1f; } mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); } if (input.KeyPress(Keys.V)) { duneBuggyOne.Teleport(new Vector3(0, 4050, 0)); } if (input.KeyPress(Keys.B)) { SwitchVehicle(); } if (input.KeyPress(Keys.F)) { duneBuggyOne.Flip(); } }
public override void Update(GameTime gameTime) { if (input.EvaluateInputBinding("MainMenu")) { SystemCore.ScreenManager.AddAndSetActive(new MainMenuScreen()); } if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } RayCastResult result; if (input.MouseLeftPress()) { Matrix camWorld = Matrix.Invert(SystemCore.ActiveCamera.View); BEPUutilities.Ray ray = new BEPUutilities.Ray(camWorld.Translation.ToBepuVector(), camWorld.Forward.ToBepuVector()); if (SystemCore.PhysicsSimulation.RayCast(ray, out result)) { Debugger.Break(); } } mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); input.CenterMouse(); List <GameObject> activeGameObjects = SystemCore.GetSubsystem <GameObjectManager>().GetAllObjects(); BoundingBox testVolume = new BoundingBox(new Vector3(-100, -100, -100), new Vector3(100, 100, 100)); foreach (GameObject activeGameObject in activeGameObjects) { if (testVolume.Contains(activeGameObject.Transform.AbsoluteTransform.Translation) == ContainmentType.Disjoint) { activeGameObject.Transform.SetPosition(-activeGameObject.Transform.AbsoluteTransform.Translation); } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (!SystemCore.CursorVisible) { if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); //input.CenterMouse(); } List <GameObject> activeGameObjects = SystemCore.GetSubsystem <GameObjectManager>().GetAllObjects(); BoundingBox testVolume = new BoundingBox(new Vector3(-100, -100, -100), new Vector3(100, 100, 100)); foreach (GameObject activeGameObject in activeGameObjects) { if (testVolume.Contains(activeGameObject.Transform.AbsoluteTransform.Translation) == ContainmentType.Disjoint) { activeGameObject.Transform.SetPosition(-activeGameObject.Transform.AbsoluteTransform.Translation); } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (!SystemCore.CursorVisible) { mouseCamera.Slow = input.EvaluateInputBinding("SlowCamera"); if (input.EvaluateInputBinding("CameraForward")) { mouseCamera.MoveForward(); } if (input.EvaluateInputBinding("CameraBackward")) { mouseCamera.MoveBackward(); } if (input.EvaluateInputBinding("CameraLeft")) { mouseCamera.MoveLeft(); } if (input.EvaluateInputBinding("CameraRight")) { mouseCamera.MoveRight(); } if (!releaseMouse) { mouseCamera.Update(gameTime, input.MouseDelta.X, input.MouseDelta.Y); input.CenterMouse(); } } if (input.EvaluateInputBinding("MainMenu")) { SystemCore.ScreenManager.AddAndSetActive(new MainMenuScreen()); } base.Update(gameTime); }