示例#1
0
        public override void Start()
        {
            base.Start();

            // Debug draw a normal triangle shape
            var builder = new ShapeBuilder();

            builder.Open(new Vector2(0, 1));
            builder.AddLine(new Vector2(-0.5f, 0.5f));
            builder.AddLine(new Vector2(0.5f, 0.5f));
            builder.Close();
            triangle = builder.Build();
        }
示例#2
0
文件: Paddle.cs 项目: Kiechant/Windup
        /* Builds the contour of the paddle and assigns the vertices to the mesh.
         * This should be called whenever the shape undergoes distrortion. */
        private void SetVertices(float drawRadius, float drawThickness)
        {
            Vector2 outerStart = new Vector2((float)Math.Cos(startAngle), (float)Math.Sin(startAngle)) * (drawRadius + drawThickness);
            Vector2 innerEnd   = new Vector2((float)Math.Cos(endAngle), (float)Math.Sin(endAngle)) * drawRadius;

            ShapeBuilder shapeBuilder = new ShapeBuilder();

            shapeBuilder.Open(outerStart);
            shapeBuilder.AddArc(new Vector2(0, 0), endAngle - startAngle, steps);
            shapeBuilder.AddLine(innerEnd);
            shapeBuilder.AddArc(new Vector2(0, 0), startAngle - endAngle, steps);
            shapeBuilder.AddLine(outerStart);
            shapeBuilder.Close();

            shape.vertices = shapeBuilder.GetVertices();
        }