public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { var vect = Axis * FastRand.NextSingle(Length * -0.5f, Length * 0.5f); offset = new Vector(vect.X, vect.Y); FastRand.NextUnitVector(out heading); }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { switch (FastRand.NextInteger(3)) { case 0: { // Left offset = new Vector(Width * -0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); break; } case 1: { // Top offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * -0.5f); break; } case 2: { // Right offset = new Vector(Width * 0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); break; } default: { // Bottom offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * 0.5f); break; } } FastRand.NextUnitVector(out heading); }
public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { offset = new Vector2(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); FastRand.NextUnitVector(out heading); }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { var dist = FastRand.NextSingle(0f, Radius); FastRand.NextUnitVector(out heading); offset = Radiate == CircleRadiation.In ? new Vector(-heading.X * dist, -heading.Y * dist) : new Vector(heading.X * dist, heading.Y * dist); if (Radiate == CircleRadiation.None) { FastRand.NextUnitVector(out heading); } }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { FastRand.NextUnitVector(out heading); if (Radiate == CircleRadiation.In) { offset = new Vector(-heading.X * Radius, -heading.Y * Radius); } else { offset = new Vector(heading.X * Radius, heading.Y * Radius); } if (Radiate == CircleRadiation.None) { FastRand.NextUnitVector(out heading); } }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { var rand = FastRand.NextInteger((int)(2 * Width + 2 * Height)); if (rand < Width) // Top { offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * -0.5f); } else if (rand < 2 * Width) // Bottom { offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * 0.5f); } else if (rand < 2 * Width + Height) // Left { offset = new Vector(Width * -0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); } else // Right { offset = new Vector(Width * 0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); } FastRand.NextUnitVector(out heading); }
public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { FastRand.NextUnitVector(out heading); switch (Radiate) { case CircleRadiation.In: offset = new Vector2(-heading.X * Radius, -heading.Y * Radius); break; case CircleRadiation.Out: offset = new Vector2(heading.X * Radius, heading.Y * Radius); break; case CircleRadiation.None: offset = new Vector2(heading.X * Radius, heading.Y * Radius); FastRand.NextUnitVector(out heading); break; default: throw new ArgumentOutOfRangeException($"{Radiate} is not supported"); } }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) { offset = Vector.Zero; FastRand.NextUnitVector(out heading); }