本文整理汇总了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);
}
示例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)
};
}