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


C# Axes.Contains方法代码示例

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


在下文中一共展示了Axes.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Lerp

        public static Vector2 Lerp(this Vector2 vector, Vector2 target, float time, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) && Mathf.Abs(target.x - vector.x) > epsilon ? Mathf.Lerp(vector.x, target.x, time) : vector.x;
            vector.y = axis.Contains(Axes.Y) && Mathf.Abs(target.y - vector.y) > epsilon ? Mathf.Lerp(vector.y, target.y, time) : vector.y;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:7,代码来源:Vector2Extensions.cs

示例2: Average

        public static float Average(this Vector4 vector, Axes axis)
        {
            float average = 0;
            int axisCount = 0;

            if (axis.Contains(Axes.X)) {
                average += vector.x;
                axisCount += 1;
            }

            if (axis.Contains(Axes.Y)) {
                average += vector.y;
                axisCount += 1;
            }

            if (axis.Contains(Axes.Z)) {
                average += vector.z;
                axisCount += 1;
            }

            if (axis.Contains(Axes.W)) {
                average += vector.w;
                axisCount += 1;
            }

            return average / axisCount;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:27,代码来源:Vector4Extensions.cs

示例3: Div

        public static Vector2 Div(this Vector2 vector, Vector2 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:7,代码来源:Vector2Extensions.cs

示例4: Div

        public static Vector3 Div(this Vector3 vector, Vector3 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z / otherVector.z : vector.z;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:8,代码来源:Vector3Extensions.cs

示例5: Div

        public static Vector4 Div(this Vector4 vector, Vector4 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z / otherVector.z : vector.z;
            vector.w = axis.Contains(Axes.W) ? vector.w / otherVector.w : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例6: Pow

        public static Vector4 Pow(this Vector4 vector, float power, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x.Pow(power) : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y.Pow(power) : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z.Pow(power) : vector.z;
            vector.w = axis.Contains(Axes.W) ? vector.w.Pow(power) : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例7: Round

        public static Vector4 Round(this Vector4 vector, float step, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x.Round(step) : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y.Round(step) : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z.Round(step) : vector.z;
            vector.w = axis.Contains(Axes.W) ? vector.w.Round(step) : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例8: Mult

        public static Vector4 Mult(this Vector4 vector, Vector4 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x * otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y * otherVector.y : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z * otherVector.z : vector.z;
            vector.w = axis.Contains(Axes.W) ? vector.w * otherVector.w : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例9: Oscillate

        public static Vector4 Oscillate(this Vector4 vector, Vector4 frequency, Vector4 amplitude, Vector4 center, float offset, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? center.x + amplitude.x * Mathf.Sin(frequency.x * Time.time + offset) : vector.x;
            vector.y = axis.Contains(Axes.Y) ? center.y + amplitude.y * Mathf.Sin(frequency.y * Time.time + offset) : vector.y;
            vector.z = axis.Contains(Axes.Z) ? center.z + amplitude.z * Mathf.Sin(frequency.z * Time.time + offset) : vector.z;
            vector.w = axis.Contains(Axes.W) ? center.w + amplitude.w * Mathf.Sin(frequency.w * Time.time + offset) : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例10: LerpAngles

        public static Vector4 LerpAngles(this Vector4 vector, Vector4 targetAngles, float time, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) && Mathf.Abs(targetAngles.x - vector.x) > epsilon ? Mathf.LerpAngle(vector.x, targetAngles.x, time) : vector.x;
            vector.y = axis.Contains(Axes.Y) && Mathf.Abs(targetAngles.y - vector.y) > epsilon ? Mathf.LerpAngle(vector.y, targetAngles.y, time) : vector.y;
            vector.z = axis.Contains(Axes.Z) && Mathf.Abs(targetAngles.z - vector.z) > epsilon ? Mathf.LerpAngle(vector.z, targetAngles.z, time) : vector.z;
            vector.w = axis.Contains(Axes.W) && Mathf.Abs(targetAngles.w - vector.w) > epsilon ? Mathf.LerpAngle(vector.w, targetAngles.w, time) : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs

示例11: Pow

        public static Vector3 Pow(this Vector3 vector, float power, Axes axes)
        {
            vector.x = axes.Contains(Axes.X) ? vector.x.Pow(power) : vector.x;
            vector.y = axes.Contains(Axes.Y) ? vector.y.Pow(power) : vector.y;
            vector.z = axes.Contains(Axes.Z) ? vector.z.Pow(power) : vector.z;

            return vector;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:8,代码来源:Vector3Extensions.cs

示例12: SetValues

        public static Vector3 SetValues(this Vector3 vector, Vector3 values, Axes axes)
        {
            vector.x = axes.Contains(Axes.X) ? values.x : vector.x;
            vector.y = axes.Contains(Axes.Y) ? values.y : vector.y;
            vector.z = axes.Contains(Axes.Z) ? values.z : vector.z;

            return vector;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:8,代码来源:Vector3Extensions.cs

示例13: SetValues

        public static Vector2 SetValues(this Vector2 vector, Vector2 values, Axes axes)
        {
            if ((axes & Axes.X) != 0)
                vector.x = axes.Contains(Axes.X) ? values.x : vector.x;

            if ((axes & Axes.Y) != 0)
                vector.y = axes.Contains(Axes.Y) ? values.y : vector.y;

            return vector;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:10,代码来源:Vector2Extensions.cs

示例14: SetValues

        public static Vector2 SetValues(this Vector2 vector, Vector2 values, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? values.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? values.y : vector.y;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:7,代码来源:Vector2Extensions.cs

示例15: Oscillate

        public static Vector3 Oscillate(this Vector3 vector, Vector3 frequency, Vector3 amplitude, Vector3 center, float time, float offset = 0f, Axes axes = Axes.XYZ)
        {
            vector.x = axes.Contains(Axes.X) ? center.x + amplitude.x * Mathf.Sin(frequency.x * time + offset) : vector.x;
            vector.y = axes.Contains(Axes.Y) ? center.y + amplitude.y * Mathf.Sin(frequency.y * time + offset) : vector.y;
            vector.z = axes.Contains(Axes.Z) ? center.z + amplitude.z * Mathf.Sin(frequency.z * time + offset) : vector.z;

            return vector;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:8,代码来源:Vector3Extensions.cs


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