本文整理汇总了C#中System.Vector4.YZW方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.YZW方法的具体用法?C# Vector4.YZW怎么用?C# Vector4.YZW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector4
的用法示例。
在下文中一共展示了Vector4.YZW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindCollisionTile
public static List<Point> FindCollisionTile(int Direction, Vector2 position, float testMagnitude, int Width, int Height, bool fallThrough = false, bool fall2 = false, int gravDir = 1, bool checkCardinals = true, bool checkSlopes = false)
{
int num;
Vector2 vector2;
Vector4 vector4;
int width;
int height;
List<Point> points = new List<Point>();
switch (Direction)
{
case 0:
case 1:
{
vector2 = (Direction == 0 ? Vector2.UnitX * testMagnitude : -Vector2.UnitX * testMagnitude);
vector4 = new Vector4(position, vector2.X, vector2.Y);
float x = position.X;
if (Direction == 0)
{
width = Width;
}
else
{
width = 0;
}
num = (int)(x + (float)width) / 16;
float single = Math.Min(16f - position.Y % 16f, (float)Height);
float single1 = single;
if (checkCardinals && Collision.TileCollision(position - vector2, vector2, Width, (int)single, fallThrough, fall2, gravDir) != vector2)
{
points.Add(new Point(num, (int)position.Y / 16));
}
else if (checkSlopes && Collision.SlopeCollision(position, vector2, Width, (int)single, (float)gravDir, fallThrough).XZW() != vector4.XZW())
{
points.Add(new Point(num, (int)position.Y / 16));
}
while (single1 + 16f <= (float)(Height - 16))
{
if (checkCardinals && Collision.TileCollision((position - vector2) + (Vector2.UnitY * single1), vector2, Width, 16, fallThrough, fall2, gravDir) != vector2)
{
points.Add(new Point(num, (int)(position.Y + single1) / 16));
}
else if (checkSlopes && Collision.SlopeCollision(position + (Vector2.UnitY * single1), vector2, Width, 16, (float)gravDir, fallThrough).XZW() != vector4.XZW())
{
points.Add(new Point(num, (int)(position.Y + single1) / 16));
}
single1 = single1 + 16f;
}
int height1 = Height - (int)single1;
if (!checkCardinals || !(Collision.TileCollision((position - vector2) + (Vector2.UnitY * single1), vector2, Width, height1, fallThrough, fall2, gravDir) != vector2))
{
if (!checkSlopes || !(Collision.SlopeCollision(position + (Vector2.UnitY * single1), vector2, Width, height1, (float)gravDir, fallThrough).XZW() != vector4.XZW()))
{
break;
}
points.Add(new Point(num, (int)(position.Y + single1) / 16));
break;
}
else
{
points.Add(new Point(num, (int)(position.Y + single1) / 16));
break;
}
}
case 2:
case 3:
{
vector2 = (Direction == 2 ? Vector2.UnitY * testMagnitude : -Vector2.UnitY * testMagnitude);
vector4 = new Vector4(position, vector2.X, vector2.Y);
float y = position.Y;
if (Direction == 2)
{
height = Height;
}
else
{
height = 0;
}
num = (int)(y + (float)height) / 16;
float single2 = Math.Min(16f - position.X % 16f, (float)Width);
float single3 = single2;
if (checkCardinals && Collision.TileCollision(position - vector2, vector2, (int)single2, Height, fallThrough, fall2, gravDir) != vector2)
{
points.Add(new Point((int)position.X / 16, num));
}
else if (checkSlopes && Collision.SlopeCollision(position, vector2, (int)single2, Height, (float)gravDir, fallThrough).YZW() != vector4.YZW())
{
points.Add(new Point((int)position.X / 16, num));
}
while (single3 + 16f <= (float)(Width - 16))
{
if (checkCardinals && Collision.TileCollision((position - vector2) + (Vector2.UnitX * single3), vector2, 16, Height, fallThrough, fall2, gravDir) != vector2)
{
points.Add(new Point((int)(position.X + single3) / 16, num));
}
else if (checkSlopes && Collision.SlopeCollision(position + (Vector2.UnitX * single3), vector2, 16, Height, (float)gravDir, fallThrough).YZW() != vector4.YZW())
{
points.Add(new Point((int)(position.X + single3) / 16, num));
}
single3 = single3 + 16f;
}
//.........这里部分代码省略.........