本文整理汇总了C#中System.Drawing.PointD.XWhenAddYTo方法的典型用法代码示例。如果您正苦于以下问题:C# PointD.XWhenAddYTo方法的具体用法?C# PointD.XWhenAddYTo怎么用?C# PointD.XWhenAddYTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.PointD
的用法示例。
在下文中一共展示了PointD.XWhenAddYTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCrash
static double CheckCrash()
{
double impulse = 0.0;
CRASHED = new bool[4] { Crash.Up, Crash.Left, Crash.Up || Crash.Down, Crash.Left || Crash.Right };
if (CRASHED[2] && !CRASHED[3]) impulse += Crash.Vertical(CRASHED[0]);
else if (CRASHED[3] && !CRASHED[2]) impulse += Crash.Horizontal(CRASHED[1]);
else if (CRASHED[2] && CRASHED[3])
{
if ((CRASHED[0] ? Corner.NothingUp : Corner.NothingDown) && (CRASHED[1] ? Corner.NothingLeft : Corner.NothingRight))
{
PointD p = new PointD(CRASHED[1] ? Corner.Left : Corner.Right, CRASHED[0] ? Corner.Up : Corner.Down);
PointD t = new PointD(CRASHED[1] ? Corner.LeftBlock + 1.0 : Corner.RightBlock, CRASHED[0] ? Corner.UpBlock + 1.0 : Corner.DownBlock);
bool y_needptoh = !CRASHED[0];
bool x_needptoh = CRASHED[1];
double v = p.XWhenAddYTo(t.Y, SPEED);
if (v.IsNaN())
{
v = p.YWhenAddXTo(t.X, SPEED);
if (!v.IsNaN())
{
if (y_needptoh == (v > t.Y)) impulse += Crash.Horizontal(CRASHED[1]);
else impulse += Crash.Vertical(CRASHED[0]);
}
}
else
{
if (x_needptoh == (v > t.X)) impulse += Crash.Horizontal(CRASHED[1]);
else impulse += Crash.Vertical(CRASHED[0]);
}
}
else impulse += Crash.Vertical(CRASHED[0]) + Crash.Horizontal(CRASHED[1]);
}
return impulse;
}