本文整理汇总了C#中System.Vector3.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Count方法的具体用法?C# Vector3.Count怎么用?C# Vector3.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.Count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NearestAlly
private static Vector3 NearestAlly(Vector3[] allyPositions)
{
if (allyPositions.Count() == 0)
return new Vector3();
var minimum = float.MaxValue;
var start = Player.Position;
Vector3 tempMin = new Vector3();
foreach (Vector3 ally in allyPositions)
{
var path = ObjectManager.Player.GetPath(start, ally);
var lastPoint = start;
var d = 0f;
d = DistanceFromArray(path);
if (d < minimum)
{
minimum = d;
tempMin = ally;
}
}
return tempMin;
}
示例2: PolygonDraw
private static void PolygonDraw(Vector3 Center, Vector3[] Points, float thickness, Color color)
{
for (int i = 0; i < Points.Count() - 1; i++)
{
var q = Drawing.WorldToScreen(new Vector3(new Vector2(Points[i].X, Points[i].Y),
Points[i].Z));
var z = Drawing.WorldToScreen(new Vector3(new Vector2(Points[i + 1].X, Points[i + 1].Y),
Points[i + 1].Z));
Drawing.DrawLine(q, z, thickness, color);
}
Drawing.DrawLine(Drawing.WorldToScreen(new Vector3(new Vector2(Points[Points.Length - 1].X, Points[Points.Length - 1].Y),
Player.Position.Z)), Drawing.WorldToScreen(new Vector3(new Vector2(Points[0].X, Points[0].Y),
Player.Position.Z)), thickness, color);
}
示例3: AddRangeVector3
private void AddRangeVector3(Vector3[] v, int level, bool isFirst)
{
int N = Vertices2[level].Count - 1;
int C = v.Count();
foreach (Vector3 v3 in v)
{
DXMEV p = new DXMEV();
p.P = new Vector4(v3.X, v3.Z, v3.Y, 1);
Vertices2[level].Add(p);
BBox.Maximum = Vector3.Max(BBox.Maximum, new Vector3(p.P.X, p.P.Y, p.P.Z));
BBox.Minimum = Vector3.Min(BBox.Minimum, new Vector3(p.P.X, p.P.Y, p.P.Z));
}
if (isFirst) { }
else
{
// Create the triangles
for (int i = 0; i < C; i++)
{
// first triangle for the "quad"
Indices2[level].Add(N - C + 1 + i); Indices2[level].Add(N + i + 1);
if (i == C - 1) Indices2[level].Add(N - C + 1); else Indices2[level].Add(N - C + 2 + i);
// second triangle for the "quad"
if (i == C - 1) Indices2[level].Add(N - C + 1); else Indices2[level].Add(N - C + 2 + i);
Indices2[level].Add(N + i + 1);
if (i == C - 1) Indices2[level].Add(N + 1); else Indices2[level].Add(N + 2 + i);
}
}
}
示例4: AddConvexHullShape
public IConvexHullShapeImp AddConvexHullShape(float3[] points, bool optimized)
{
var btPoints = new Vector3[points.Count()];
for (int i = 0; i < btPoints.Count(); i++)
{
var point = Translater.Float3ToBtVector3(points[i]);
btPoints[i] = point;
}
var btConvexHullShape = new ConvexHullShape(btPoints);
//btConvexHullShape.LocalScaling = new Vector3(3, 3, 3);
if (optimized == true)
{
var btShapeHull = new ShapeHull(btConvexHullShape);
var margin = btConvexHullShape.Margin;
btShapeHull.BuildHull(margin);
ConvexHullShape simplifiedConvexShape = new ConvexHullShape(btShapeHull.Vertices);
BtCollisionShapes.Add(simplifiedConvexShape);
var retval = new ConvexHullShapeImp();
retval.BtConvexHullShape = simplifiedConvexShape;
simplifiedConvexShape.UserObject = retval;
return retval;
}
else
{
BtCollisionShapes.Add(btConvexHullShape);
var retval = new ConvexHullShapeImp();
retval.BtConvexHullShape = btConvexHullShape;
btConvexHullShape.UserObject = retval;
return retval;
}
}
示例5: GetNextPoint
public static Vector3 GetNextPoint(Vector3[] positions)
{
if(positions.Count()==0)
return new Vector3();
var minimum = float.MaxValue;
var start = Player.Position;
Vector3 tempMin = new Vector3();
foreach (Vector3 chime in positions)
{
var path = ObjectManager.Player.GetPath(start, chime);
var lastPoint = start;
var d = 0f;
d = DistanceFromArray(path);
if (d < minimum)
{
minimum = d;
tempMin = chime;
}
}
return tempMin;
}