本文整理汇总了C#中MCForge.Utils.Vector3S.GetDimention方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3S.GetDimention方法的具体用法?C# Vector3S.GetDimention怎么用?C# Vector3S.GetDimention使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Utils.Vector3S
的用法示例。
在下文中一共展示了Vector3S.GetDimention方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PathTo
/// <summary>
/// Creates a path to another vector
/// </summary>
/// <param name="vectorTo">The vector to.</param>
/// <returns>An enumeration of a path from a vector to a vector</returns>
public IEnumerable<Vector3S> PathTo(Vector3S vectorTo)
{
Vector3D pos = new Vector3D(this);
Vector3S rounded = pos.GetRounded();
while (rounded != vectorTo) {
yield return rounded;
pos.Move(1, new Vector3D(vectorTo));
rounded = pos.GetRounded();
}
yield return vectorTo;
yield break;
Vector3S tempThis = new Vector3S(this);
Vector3S a = vectorTo - this;
Vector3S b = MathUtils.SignVector(a);
a = MathUtils.AbsVector(a);
Vector3S c = a * 2;
int x, z, y;
if ((a.x >= a.y) && (a.x >= a.z)) {
x = 0; z = 1; y = 2;
}
else if ((a.y >= a.x) && (a.y >= a.z)) {
x = 1; z = 2; y = 0;
}
else {
x = 2; z = 0; y = 1;
}
int right = c.GetDimention(y) - a.GetDimention(x);
int left = c.GetDimention(z) - a.GetDimention(x);
for (int j = 0; j < a.GetDimention(x); j++) {
yield return tempThis;
if (right > 0) {
tempThis.SetValueInDimention(y, (short)(b.GetDimention(y) + tempThis.GetDimention(y)));
right -= c.GetDimention(x);
}
if (left > 0) {
tempThis.SetValueInDimention(z, (short)(b.GetDimention(z) + tempThis.GetDimention(z)));
left -= c.GetDimention(x);
}
right += c.GetDimention(y);
left += c.GetDimention(z);
tempThis.SetValueInDimention(x, (short)(b.GetDimention(x) + tempThis.GetDimention(x)));
}
yield return vectorTo;
}