本文整理汇总了C#中PPos.ToFloat2方法的典型用法代码示例。如果您正苦于以下问题:C# PPos.ToFloat2方法的具体用法?C# PPos.ToFloat2怎么用?C# PPos.ToFloat2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PPos
的用法示例。
在下文中一共展示了PPos.ToFloat2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public IEnumerable<Renderable> Render(WorldRenderer wr)
{
if (explosion != null)
yield return new Renderable(explosion.Image, args.dest.ToFloat2() - .5f * explosion.Image.size,
wr.Palette("effect"), (int)args.dest.Y);
if (ticks >= info.BeamDuration)
yield break;
var rc = Color.FromArgb((info.BeamDuration - ticks)*255/info.BeamDuration, color);
var src = new PPos(args.src.X, args.src.Y - args.srcAltitude);
var dest = new PPos(args.dest.X, args.dest.Y - args.destAltitude);
var wlr = Game.Renderer.WorldLineRenderer;
wlr.LineWidth = info.BeamRadius * 2;
wlr.DrawLine(src.ToFloat2(), dest.ToFloat2(), rc, rc);
wlr.Flush();
wlr.LineWidth = 1f;
}
示例2: DrawZapWandering
static IEnumerable<Renderable> DrawZapWandering(WorldRenderer wr, PPos from, PPos to, Sequence s)
{
var z = float2.Zero; /* hack */
var dist = to - from;
var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X);
var renderables = new List<Renderable>();
if (Game.CosmeticRandom.Next(2) != 0)
{
var p1 = from.ToFloat2() + (1 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
var p2 = from.ToFloat2() + (2 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1));
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2));
renderables.AddRange(DrawZap(wr, p2, to.ToFloat2(), s, out z));
}
else
{
var p1 = from.ToFloat2() + (1 / 2f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1));
renderables.AddRange(DrawZap(wr, p1, to.ToFloat2(), s, out z));
}
return renderables;
}