本文整理汇总了C#中Game.Orig.Math3D.MyVector.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# MyVector.GetUpperBound方法的具体用法?C# MyVector.GetUpperBound怎么用?C# MyVector.GetUpperBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Orig.Math3D.MyVector
的用法示例。
在下文中一共展示了MyVector.GetUpperBound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFieldLines
/// <summary>
/// This function stores the field lines passed in
/// </summary>
/// <remarks>
/// 2D arrays are not optimized, but in this case, it's easier for the outside user to work with.
/// </remarks>
/// <param name="fieldLines">fieldLines[X, Y] (x and y go from 0 to SquaresPerSide - 1)</param>
public void SetFieldLines(MyVector[,] fieldLines)
{
// Check out the array
if (fieldLines == null)
{
throw new ArgumentNullException("fieldLines", "fieldLines cannot be null");
}
if (fieldLines.GetUpperBound(0) != _squaresPerSideX - 1)
{
throw new ArgumentOutOfRangeException("fieldLines.GetUpperBound(0)", fieldLines.GetUpperBound(0), "fieldLines.GetUpperBound(0) must be the same as _squaresPerSideX - 1\nUBound: " + fieldLines.GetUpperBound(0).ToString() + ", _squaresPerSideX - 1: " + ((int)(_squaresPerSideX - 1)).ToString());
}
if (fieldLines.GetUpperBound(1) != _squaresPerSideY - 1)
{
throw new ArgumentOutOfRangeException("fieldLines.GetUpperBound(1)", fieldLines.GetUpperBound(1), "fieldLines.GetUpperBound(1) must be the same as _squaresPerSideY - 1\nUBound: " + fieldLines.GetUpperBound(1).ToString() + ", _squaresPerSideY - 1: " + ((int)(_squaresPerSideY - 1)).ToString());
}
// Init my grid
_grid = new MyVector[fieldLines.Length];
// Store the lines
for (int xCntr = 0; xCntr <= fieldLines.GetUpperBound(0); xCntr++)
{
for (int yCntr = 0; yCntr <= fieldLines.GetUpperBound(1); yCntr++)
{
_grid[GetIndex(xCntr, yCntr)] = fieldLines[xCntr, yCntr];
}
}
// Put myself into a custom state
_fieldMode = VectorField2DMode.Custom;
// No need to call ResetField()
}