public override void HandleInput(GameTime gameTime) { Vector3 nearsource = new Vector3(InputManager.MousePosition, 0f); Vector3 farsource = new Vector3(InputManager.MousePosition, 1f); Matrix worldMatrix = Matrix.CreateTranslation(0, 0, 0); Vector3 nearPoint = ScreenManager.Globals.Graphics.Viewport.Unproject(nearsource, ScreenManager.Globals.DefaultEffect.Projection, ScreenManager.Globals.DefaultEffect.View, worldMatrix); Vector3 farPoint = ScreenManager.Globals.Graphics.Viewport.Unproject(farsource, ScreenManager.Globals.DefaultEffect.Projection, ScreenManager.Globals.DefaultEffect.View, worldMatrix); Vector3 mouseRayDirection = farPoint - nearPoint; float t = (0.1f - nearPoint.Y) / mouseRayDirection.Y; Vector3 mousePlanePos = new Vector3(nearPoint.X + mouseRayDirection.X * t, 0.1f, nearPoint.Z + mouseRayDirection.Z * t); cursor.WorldPosition = mousePlanePos; if (!focused && !ScreenManager.IsMouseVisible) { bool foundTarget = false; foreach (var keyValue in currentSession.Worlds) { Location location = keyValue.Value; Vector3 distance = new Vector3(cursor.WorldPosition.X - location.WorldPlane.WorldPosition.X, 0, cursor.WorldPosition.Z - location.WorldPlane.WorldPosition.Z); if (distance.LengthSquared() < location.CursorDetectRadius * location.CursorDetectRadius && location.IsVisible) { if (keyValue.Key == "Skaia") { } cursorTarget = location; if (!(cursor.Modifiers[0] is ColorModifier3D)) { cursor.AddModifier(new ColorModifier3D(location.PrimaryColor, true, cursor, 10)); } foundTarget = true; break; } } if (!foundTarget) { cursorTarget = null; if (!(cursor.Modifiers[0] is ColorModifier3D)) { cursor.AddModifier(new ColorModifier3D(Color.White, true, cursor, 10)); } } } descriptionControl.HandleInput(); descriptionBox.HandleInput(); descriptionText.HandleInput(); //timelineControl.HandleInput(); if (InputManager.IsKeyTriggered(Keys.Escape)) { RemoveSelf(); } }
public SessionLocation(string filePath, DynamicContentManager Content) { SessionLocationBuilder builder = SessionLocationBuilder.BuilderRead(filePath); plane = new TexturedPlane(builder.Image); plane.billboard = true; isVisible = builder.IsVisible; PrimaryColor = new Color((byte)builder.PrimaryColor.X, (byte)builder.PrimaryColor.Y, (byte)builder.PrimaryColor.Z, (byte)builder.PrimaryColor.W); Name = builder.Name; Description = builder.Description; CursorDetectRadius = builder.CursorDetectRadius; if (builder.InitialAngle != 0 || builder.OrbitalSpeed != 0 || builder.OrbitHeight != 0 || builder.DistFromCenter != 0) { UserPlaced = true; initialDistFromCenter = builder.DistFromCenter; initialAngle = builder.InitialAngle; initialOrbitalSpeed = builder.OrbitalSpeed; initialOrbitHeight = builder.OrbitHeight; plane.AddModifier(new OrbitModifier3D(new Vector3(0, builder.OrbitHeight, 0), Vector3.Up, builder.DistFromCenter, builder.InitialAngle, builder.OrbitalSpeed, plane, false, -1)); } else { UserPlaced = false; } }
private void constructSkaia() { godTierInnerSpiro = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(45), new Color(182, 251, 255, 100), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//God Tier 1.png")); godTierInnerSpiro.depthBias = -0.02f; godTierInnerSpiro.AddModifier(new BillboardRotateModifier3D(0.0005f, true, false, -1)); godTierInnerFill = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(45), new Color(0, 197, 255, 66), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//God Tier 2.png")); godTierInnerFill.depthBias = -0.01f; godTierInnerFill.AddModifier(new BillboardRotateModifier3D(0.0005f, true, false, -1)); godTierOuterSpiro = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(67), new Color(182, 251, 255, 66), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//God Tier 1.png")); godTierOuterSpiro.depthBias = -0.04f; godTierOuterSpiro.AddModifier(new BillboardRotateModifier3D(0.0005f, true, false, -1)); godTierOuterFill = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(67), new Color(0, 197, 255, 66), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//God Tier 2.png")); godTierOuterFill.depthBias = -0.03f; godTierOuterFill.AddModifier(new BillboardRotateModifier3D(0.0005f, true, false, -1)); glowEffect = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(40), new Color(0, 197, 255, 128), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//Glow.png")); glowEffect.depthBias = -0.05f; godTierSymbol = new TexturedPlane(new Vector3(0, 8, 0), Quaternion.Identity, new Vector2(7), new Color(0, 0, 0, 255), true, ScreenManager.Content.Load <Texture2D>(".//Miscellaneous//of Breath.png")); godTierSymbol.depthBias = -0.06f; lowerSpirograph = new Spirograph(1f, 10f / 7f, 7, 1, 12, 0, Color.White); lowerSpirograph.Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, MathHelper.PiOver2); lowerSpirograph.WorldPosition = new Vector3(0, 2, 0); lowerSpirograph.AddModifier(new RotateModifier3D(Quaternion.CreateFromYawPitchRoll(-0.01f, 0, 0), false, -1)); lowerSpirograph.Generate(600); reckoningGates = new Spirograph[50]; }
private PlayerWorld(TexturedPlane image, Color primaryColor, Color secondaryColor, string name, string description, int gate, string playerName, bool playerEntered, bool isVisible, float initAngle, float initDist, float initSpeed, float initHeight) { plane = image; PrimaryColor = primaryColor; SecondaryColor = secondaryColor; Name = name; Description = description; gateLevel = gate; PlayerName = playerName; this.playerEntered = playerEntered; this.isVisible = isVisible; if (initAngle != 0 || initSpeed != 0 || initHeight != 0 || initDist != 0) { UserPlaced = true; initialDistFromCenter = initDist; initialAngle = initAngle; initialOrbitalSpeed = initSpeed; initialOrbitHeight = initHeight; planeOrbit = new OrbitModifier3D(new Vector3(0, initHeight, 0), Vector3.Up, initDist, initAngle, initSpeed, plane, false, -1); plane.AddModifier(planeOrbit); } else { UserPlaced = false; } }
public void AddModifier(IModifier3D modifier) { plane.AddModifier(modifier); }