当前位置: 首页>>代码示例>>C#>>正文


C# Vector2.AddLengthDir方法代码示例

本文整理汇总了C#中System.Vector2.AddLengthDir方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.AddLengthDir方法的具体用法?C# Vector2.AddLengthDir怎么用?C# Vector2.AddLengthDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Vector2的用法示例。


在下文中一共展示了Vector2.AddLengthDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

 public override void Draw(Renderer renderer, Vector2 position, double direction, Cairo.Color? fillColor, Cairo.Color? strokeColor, double scale)
 {
     Context g = renderer.Context;
     g.MoveTo(position.ToPointD());
     g.LineTo(position.AddLengthDir(scale, MathHelper.PiOver2).ToPointD());
     g.LineTo(position.AddLengthDir(scale, MathHelper.PiOver4 * 9).ToPointD());
     g.ClosePath();
     renderer.StrokeAndFill(fillColor, strokeColor);
 }
开发者ID:adamrezich,项目名称:arena,代码行数:9,代码来源:Shapes.cs

示例2: Initialize

 public void Initialize()
 {
     //int laneWidth = 177;
     int gutter = BaseWidth / 2 - LaneWidth / 2;
     Vector2 baseCorner = new Vector2(BaseWidth, Width - BaseWidth);
     Vector2 _midTop = baseCorner.AddLengthDir(LaneWidth / 2, -(MathHelper.PiOver4 * 3));
     Vector2 _midBot = baseCorner.AddLengthDir(LaneWidth / 2, MathHelper.PiOver4);
     Vector2 _center = new Vector2(Width / 2, Width / 2);
     Vector2 _centerTop = _center.AddLengthDir(LaneWidth / 2, -(MathHelper.PiOver4 * 3));
     Vector2 _centerBot = _center.AddLengthDir(LaneWidth / 2, MathHelper.PiOver4);
     VGame.Point midTop = new VGame.Point((int)Math.Round(_midTop.X), (int)Math.Round(_midTop.Y));
     VGame.Point midBot = new VGame.Point((int)Math.Round(_midBot.X), (int)Math.Round(_midBot.Y));
     VGame.Point centerTop = new VGame.Point((int)Math.Round(_centerTop.X), (int)Math.Round(_centerTop.Y));
     VGame.Point centerBot = new VGame.Point((int)Math.Round(_centerBot.X), (int)Math.Round(_centerBot.Y));
     VGame.Point center = new VGame.Point(Width / 2, Width / 2);
     Terrain = new List<Polygon>() {
         // base
         new Polygon(0, Width, BaseWidth, Width, 0, Width - BaseWidth),
         new Polygon(BaseWidth, Width - BaseWidth, BaseWidth, Width, 0, Width - BaseWidth),
         // hardlane
         new Polygon(gutter, Width - BaseWidth, BaseWidth / 2 + LaneWidth / 2, Width - BaseWidth, gutter, gutter),
         new Polygon(BaseWidth / 2 + LaneWidth / 2, Width - BaseWidth, gutter, gutter, gutter + LaneWidth, gutter + LaneWidth),
         // safelane
         new Polygon(BaseWidth, Width - BaseWidth + gutter, BaseWidth, Width - gutter, Width - gutter, Width - gutter),
         new Polygon(BaseWidth, Width - BaseWidth + gutter, Width - gutter - LaneWidth, Width - gutter - LaneWidth, Width - gutter, Width - gutter),
         // midlane
         /*new Polygon(BaseWidth - gutter, Width - BaseWidth, BaseWidth, Width - BaseWidth, midTop.X, midTop.Y),
         new Polygon(BaseWidth, Width - BaseWidth + gutter, BaseWidth, Width - BaseWidth, midBot.X, midBot.Y),
         new Polygon(midTop, midBot, centerTop),
         new Polygon(midBot, centerTop, centerBot)*/
     };
     List<Polygon> flip = new List<Polygon>(Terrain);
     foreach (Polygon p in flip) {
         p.RotateAbout(new VGame.Point(Width / 2, Width / 2), MathHelper.Pi);
         Terrain.Add(p);
     }
     Decorations = new List<Tuple<Line, Color>>() {
         new Tuple<Line, Color>(new Line(0, 0, Width, Width), ColorPresets.Red)
     };
 }
开发者ID:adamrezich,项目名称:arena,代码行数:40,代码来源:Pitch.cs


注:本文中的System.Vector2.AddLengthDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。