當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.Equals方法代碼示例

本文整理匯總了C#中Color.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.Equals方法的具體用法?C# Color.Equals怎麽用?C# Color.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Color的用法示例。


在下文中一共展示了Color.Equals方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LightBall

    public LightBall(string name, Vector3 sPos, Transform eObj, float lTime, Color glowColor)
    {
        endPos = eObj.position;
        lifeTime = lTime;
        string prefabName = "LightBall(Clone)";
        GameObject lightPrefab = PrefabFactory.GetLightBallPrefab();
        if (glowColor.Equals(Color.red)){
            lightPrefab = PrefabFactory.GetLightBallRedPrefab();
            prefabName = "LightBallRed(Clone)";
        }
        else if (glowColor.Equals (Color.blue)){
            lightPrefab = PrefabFactory.GetLightBallBluePrefab();
            prefabName = "LightBallBlue(Clone)";
        }
        else if (glowColor.Equals (Color.black)){
            lightPrefab = PrefabFactory.GetLightBallDarkPrefab();
            prefabName = "LightBallDark(Clone)";
        }
        GameManager.InstantiateModel(lightPrefab, sPos);
        lightBall = GameObject.Find(prefabName);
        lightBall.name = name;
        lightBall.AddComponent("LightBallMove");
        lightBall.transform.LookAt(eObj);

        GameObject glow = lightBall.transform.Find("Glow").gameObject;
        glow.light.color = glowColor;
    }
開發者ID:Duelist,項目名稱:Project-Reach,代碼行數:27,代碼來源:LightBall.cs

示例2: colorLerp1

 IEnumerator colorLerp1(Color col1, Color col2)
 {
     float step = 0f;
     while (!col1.Equals(col2))
     {
         yield return new WaitForSeconds(0.01f);
        this.gameObject.GetComponent<Renderer>().material.SetColor("_Color", Color.Lerp(col1, col2, step += 0.005f));
     }
     yield return null;
 }
開發者ID:RuslanAhmetsharipov,項目名稱:TalkingHead,代碼行數:10,代碼來源:MaterialChanging.cs

示例3: SetColor

 public void SetColor(Color newColor, float duration = 0)
 {
     // Don't do anything if we're being set to the same color:
     if(!newColor.Equals(targetColor))
     {
         startColor = Color;
         targetColor = newColor;
         this.duration = duration;
         timer = 0;
     } 
 }
開發者ID:wx3,項目名稱:galacdecks,代碼行數:11,代碼來源:LerpTint.cs

示例4: Equals

 public void Equals()
 {
     var color1 = new Color(10, 20, 30, 40);
     var color2 = new Color(20, 30, 40, 50);
     Assert.AreNotEqual(color1, color2);
     Assert.AreEqual(color1, new Color(10, 20, 30, 40));
     Assert.IsTrue(color1 == new Color(10, 20, 30, 40));
     Assert.IsTrue(color1 != color2);
     Assert.IsTrue(color1.Equals((object)new Color(10, 20, 30, 40)));
     Assert.AreEqual(color1.PackedRgba, color1.GetHashCode());
 }
開發者ID:hillwhite,項目名稱:DeltaEngine,代碼行數:11,代碼來源:ColorTests.cs

示例5: RobotRenderComponent

        public RobotRenderComponent(Entity parent, float height, float scale, Color color)
            : base(parent, ContentLoader.Robot)
        {
            this.Transform = Matrix.Identity;
            this.height = height;
            this.colorEffect = ContentLoader.ColorEffect;
            this.scale = scale;

            // Temp fix...
            if (color.Equals(Color.Red))
            {
                this.model = ContentLoader.RobotRed;
            }
            else if (color.Equals(Color.Blue))
            {
                this.model = ContentLoader.RobotBlue;
            }
            else if (color.Equals(Color.Yellow))
            {
                this.model = ContentLoader.RobotYellow;
            }
        }
開發者ID:regenvanwalbeek,項目名稱:BattleFury,代碼行數:22,代碼來源:RobotRenderComponent.cs

示例6: getConsoleColor

 public static String getConsoleColor(Color cellColor)
 {
     if (cellColor.Equals(Color.Black))
     {
         return "x";
     }
     else if (cellColor.Equals(Color.Cyan))
     {
         return "I";
     }
     else if (cellColor.Equals(Color.Blue))
     {
         return "J";
     }
     else if (cellColor.Equals(Color.Orange))
     {
         return "L";
     }
     else if (cellColor.Equals(Color.Yellow))
     {
         return "O";
     }
     else if (cellColor.Equals(Color.Green))
     {
         return "S";
     }
     else if (cellColor.Equals(Color.Purple))
     {
         return "T";
     }
     else if (cellColor.Equals(Color.Red))
     {
         return "Z";
     }
     else
     {
         return "X";
     }
 }
開發者ID:codec-abc,項目名稱:3DIsoTetrisXNA,代碼行數:39,代碼來源:GameLogic.cs

示例7: GenerateColorFromNeighbor

    Color GenerateColorFromNeighbor(XY xy , Color[,] pixels )
    {
        List<XY> neigh = getneighbors(xy,pixels,false);
        float sumR =0 , sumG = 0, sumB = 0;
        foreach(XY n in neigh )
        {
            sumR += pixels[n.x,n.y].r;
            sumG += pixels[n.x,n.y].g;
            sumB += pixels[n.x,n.y].b;
        }
        Color res = new Color( sumR / neigh.Count , sumG / neigh.Count , sumB / neigh.Count );
        res.r += UnityEngine.Random.Range(-diversity,diversity);
        res.g += UnityEngine.Random.Range(-diversity,diversity);
        res.b += UnityEngine.Random.Range(-diversity,diversity);

        if ( res.Equals(Color.black))
        {

            res.r = res.g = res.b  = 0.05f;
        }
        return res;
    }
開發者ID:AtwoodDeng,項目名稱:spaceChange,代碼行數:22,代碼來源:DrawColorful.cs

示例8: Equality

        public void Equality(Color left, Color right, bool expected)
        {
            Assert.True(left.Equals(left), "left should always Equals itself");
            Assert.True(right.Equals(right), "right should always Equals itself");

            Assert.Equal(expected, left == right);
            Assert.Equal(expected, right == left);

            Assert.Equal(expected, left.Equals(right));
            Assert.Equal(expected, right.Equals(left));

            Assert.Equal(!expected, left != right);
            Assert.Equal(!expected, right != left);
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:14,代碼來源:ColorTests.cs

示例9: Ensure_that_equals_returns_true_for_identity

 public void Ensure_that_equals_returns_true_for_identity()
 {
     var color = new Color(0, 0, 0);
     Assert.IsTrue(color.Equals(color));
     Assert.IsTrue(color.Equals((object)color));
 }
開發者ID:killthrush,項目名稱:DomainLayerSample,代碼行數:6,代碼來源:ColorTests.cs

示例10: Ensure_that_equals_returns_false_when_compared_with_null

 public void Ensure_that_equals_returns_false_when_compared_with_null()
 {
     var color = new Color(0, 0, 0);
     Assert.IsFalse(color.Equals(null));
     Assert.IsFalse(color.Equals((object)null));
 }
開發者ID:killthrush,項目名稱:DomainLayerSample,代碼行數:6,代碼來源:ColorTests.cs

示例11: Ensure_that_equals_returns_false_when_compared_with_a_different_type_of_object

 public void Ensure_that_equals_returns_false_when_compared_with_a_different_type_of_object()
 {
     var color = new Color(0, 0, 0);
     Assert.IsFalse(color.Equals(""));
 }
開發者ID:killthrush,項目名稱:DomainLayerSample,代碼行數:5,代碼來源:ColorTests.cs

示例12: SetColor

 /// <summary>
 /// Helper function sets a color overlay for every vertex in the buffer
 /// </summary>
 /// <param name="color">Color</param>
 public void SetColor(Color color)
 {
     // inefficient
     if (color.Equals(verts[0].Color))
         return;
     for (int i = 0; i < verts.Length; i++)
     {
         verts[i].Color = color;
     }
     vertexBuffer.SetData<VertexPositionColorTexture>(verts);
 }
開發者ID:Loko,項目名稱:GXT,代碼行數:15,代碼來源:gxtDrawablePolygon.cs

示例13: VColor

 /// <summary>
 /// sets the vertex color of a tile
 /// </summary>
 public Color VColor(IVector2 tile, Color color)
 {
     try
     {
         Color[] colors = mesh.colors;
         int vidx = ((tile.x * tileMatrix.y) + tile.y) * 4;
         if (!color.Equals(Color.clear))
         {
             colors[vidx + 0] = color;
             colors[vidx + 1] = color;
             colors[vidx + 2] = color;
             colors[vidx + 3] = color;
             mesh.colors = colors;
         }
         return colors[vidx + 0];
     }
     catch(System.Exception)
     {
     }
     return Color.clear;
 }
開發者ID:kdiggety,項目名稱:KayDiggsProjects,代碼行數:24,代碼來源:OTTilesSprite.cs


注:本文中的Color.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。