////////////////////////////////////////////////////////////////////////// public Effect Set(ShapeVisualizer shape, Vector2 from, Vector2 to) { // set values m_Shape = shape; m_From = from; m_To = to; // return effect return(Effect); }
protected static void DrawCircle(Vector2 center, float radius, ref Vector2[] points, Color color) { Collider2dPointsGetter.GetCircleCoordinates(center, radius, ref points); ShapeVisualizer.DrawPoints(points, false, color); Gizmos.DrawLine(points[0], points[points.Length - 1]); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); Vector3 cameraPosition = Vector3.Backward * 2; Matrix cameraView = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up); Matrix cameraProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(55), GraphicsDevice.Viewport.AspectRatio, 1, 100); float rotationAngle = (float)gameTime.TotalGameTime.TotalSeconds / 3.0f; Quaternion rotation = Quaternion.CreateFromYawPitchRoll(rotationAngle, 0, 0); switch (_activeShape) { case 0: ShapeVisualizer.DrawWireframeBox(cameraPosition, cameraView, cameraProjection, Vector3.Zero, Vector3.One, rotation, Color.Red); break; case 1: { var matrix = Matrix.CreateLookAt(new Vector3(-5, 1, -5), new Vector3(0, 0, -10), Vector3.Up) * Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 1, 1, 10); var frustum = new BoundingFrustum(matrix); ShapeVisualizer.DrawWireframeFrustum(cameraView, cameraProjection, frustum, Color.Gray); break; } case 2: { var corners = new[] { new Vector3(-1, -1, 0), new Vector3(1, -1, -1), new Vector3(-1, 1, 0), new Vector3(1, 1, -3) }; ShapeVisualizer.DrawSolidRectangle(cameraView, cameraProjection, corners, Color.Blue); break; } case 3: { for (int i = 0; i < 360; i += 30) { ShapeVisualizer.DrawLine(cameraView, cameraProjection, Vector3.Zero, Vector3.TransformNormal(Vector3.Up, Matrix.CreateRotationZ(MathHelper.ToRadians(i))), Color.Yellow); } break; } case 4: { ShapeVisualizer.DrawWireframeDisc(cameraPosition, cameraView, cameraProjection, Vector3.Zero, Vector3.Forward, 0.8f, Color.White, false); break; } case 5: { ShapeVisualizer.DrawWireframeSphere(cameraPosition, cameraView, cameraProjection, Vector3.Zero, Vector3.Forward, 0.8f, rotation * Quaternion.CreateFromYawPitchRoll(0.2f, 0.4f, 0.1f), Color.White); break; } } DrawOverlayText(); base.Draw(gameTime); }
private void SetRandomShape() { m_Shape = (TetrisManager.Instance.BoardVisualizer as BoardVisualizer)?.ShapeList.RandomItem(); }
////////////////////////////////////////////////////////////////////////// public Effect Set(ShapeVisualizer shape) { m_Shape = shape; return(Effect); }
private void SetActiveShape() { m_Shape = (TetrisManager.Instance.BoardVisualizer as BoardVisualizer)?.ActiveShape; }