当前位置: 首页>>代码示例>>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;未经允许,请勿转载。