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


C# Vector3S.SetValueInDimention方法代码示例

本文整理汇总了C#中MCForge.Utils.Vector3S.SetValueInDimention方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3S.SetValueInDimention方法的具体用法?C# Vector3S.SetValueInDimention怎么用?C# Vector3S.SetValueInDimention使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCForge.Utils.Vector3S的用法示例。


在下文中一共展示了Vector3S.SetValueInDimention方法的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;
        }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:54,代码来源:Vector3S.cs


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