当前位置: 首页>>代码示例>>C#>>正文


C# MyVector.GetUpperBound方法代码示例

本文整理汇总了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()
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:42,代码来源:VectorField2D.cs


注:本文中的Game.Orig.Math3D.MyVector.GetUpperBound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。