本文整理汇总了C#中Vector4.XZW方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.XZW方法的具体用法?C# Vector4.XZW怎么用?C# Vector4.XZW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4.XZW方法的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)
{
List<Point> list = new List<Point>();
switch (Direction)
{
case 0:
case 1:
{
Vector2 vector = (Direction == 0) ? (Vector2.UnitX * testMagnitude) : (-Vector2.UnitX * testMagnitude);
Vector4 vec = new Vector4(position, vector.X, vector.Y);
int num = (int)(position.X + (float)((Direction == 0) ? Width : 0)) / 16;
float num2 = Math.Min(16f - position.Y % 16f, (float)Height);
float num3 = num2;
if (checkCardinals && Collision.TileCollision(position - vector, vector, Width, (int)num2, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point(num, (int)position.Y / 16));
}
else if (checkSlopes && Collision.SlopeCollision(position, vector, Width, (int)num2, (float)gravDir, fallThrough).XZW() != vec.XZW())
{
list.Add(new Point(num, (int)position.Y / 16));
}
while (num3 + 16f <= (float)(Height - 16))
{
if (checkCardinals && Collision.TileCollision(position - vector + Vector2.UnitY * num3, vector, Width, 16, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point(num, (int)(position.Y + num3) / 16));
}
else if (checkSlopes && Collision.SlopeCollision(position + Vector2.UnitY * num3, vector, Width, 16, (float)gravDir, fallThrough).XZW() != vec.XZW())
{
list.Add(new Point(num, (int)(position.Y + num3) / 16));
}
num3 += 16f;
}
int height = Height - (int)num3;
if (checkCardinals && Collision.TileCollision(position - vector + Vector2.UnitY * num3, vector, Width, height, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point(num, (int)(position.Y + num3) / 16));
}
else if (checkSlopes && Collision.SlopeCollision(position + Vector2.UnitY * num3, vector, Width, height, (float)gravDir, fallThrough).XZW() != vec.XZW())
{
list.Add(new Point(num, (int)(position.Y + num3) / 16));
}
break;
}
case 2:
case 3:
{
Vector2 vector = (Direction == 2) ? (Vector2.UnitY * testMagnitude) : (-Vector2.UnitY * testMagnitude);
Vector4 vec = new Vector4(position, vector.X, vector.Y);
int num = (int)(position.Y + (float)((Direction == 2) ? Height : 0)) / 16;
float num4 = Math.Min(16f - position.X % 16f, (float)Width);
float num5 = num4;
if (checkCardinals && Collision.TileCollision(position - vector, vector, (int)num4, Height, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point((int)position.X / 16, num));
}
else if (checkSlopes && Collision.SlopeCollision(position, vector, (int)num4, Height, (float)gravDir, fallThrough).YZW() != vec.YZW())
{
list.Add(new Point((int)position.X / 16, num));
}
while (num5 + 16f <= (float)(Width - 16))
{
if (checkCardinals && Collision.TileCollision(position - vector + Vector2.UnitX * num5, vector, 16, Height, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point((int)(position.X + num5) / 16, num));
}
else if (checkSlopes && Collision.SlopeCollision(position + Vector2.UnitX * num5, vector, 16, Height, (float)gravDir, fallThrough).YZW() != vec.YZW())
{
list.Add(new Point((int)(position.X + num5) / 16, num));
}
num5 += 16f;
}
int width = Width - (int)num5;
if (checkCardinals && Collision.TileCollision(position - vector + Vector2.UnitX * num5, vector, width, Height, fallThrough, fall2, gravDir) != vector)
{
list.Add(new Point((int)(position.X + num5) / 16, num));
}
else if (checkSlopes && Collision.SlopeCollision(position + Vector2.UnitX * num5, vector, width, Height, (float)gravDir, fallThrough).YZW() != vec.YZW())
{
list.Add(new Point((int)(position.X + num5) / 16, num));
}
break;
}
}
return list;
}