當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。