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


C# HSBColor.ToColor方法代码示例

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


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

示例1: CloseToWallTint

	public void CloseToWallTint(float distance)
	{
		HSBColor tempColor = new HSBColor (bgMat.color);
		distance = Mathf.Clamp(50 - distance, 0, tempColor.b);
		tempColor.b -= distance;
		bgMat.SetColor ("_EmissionColor", tempColor.ToColor());
	}
开发者ID:samkern108,项目名称:InteractiveFiction,代码行数:7,代码来源:Background.cs

示例2: Update

    // Update is called once per frame
    void Update()
    {
        if (HSLToRGB) {
            hsl = new HSBColor(h, s, l);
            rgbCol = hsl.ToColor();

            renderer.material.color = rgbCol;

            r = rgbCol.r;
            g = rgbCol.g;
            b = rgbCol.b;
        } else {
            hsl = HSBColor.FromColor(rgbCol);
            Color temp = hsl.ToColor();

            renderer.material.color = temp;

            h = hsl.h;
            s = hsl.s;
            l = hsl.b;
            r = temp.r;
            g = temp.g;
            b = temp.b;
        }
    }
开发者ID:mjewkes,项目名称:SpaceRaceCollab,代码行数:26,代码来源:HSBTest.cs

示例3: GenerateNewColor

	void GenerateNewColor()
	{
		HSBColor newColor = new HSBColor(Random.value, saturation, brightness, alpha);

		renderer.material.color = newColor.ToColor();


	}
开发者ID:adamison,项目名称:Transformation,代码行数:8,代码来源:RandomMaterialHue.cs

示例4: Update

	// Update is called once per frame
	void Update ()
	{
		HSBColor newColor = new HSBColor(Random.value,saturation,brightness,alpha);
		
		foreach(Material mat in materialsToChange)
		{	
			mat.color = newColor.ToColor();
		}
	}
开发者ID:HarizMustafa,项目名称:SpessShooterX,代码行数:10,代码来源:RandomMaterialHue.cs

示例5: Start

	// Use this for initialization
	void Start () {
		HSBColor color;
		color = new HSBColor(Random.Range(0.0f, 1.0f), 1f, 1f);
		Color col;
		col =color.ToColor();		

		foreach (Renderer r in transform.GetComponentsInChildren<Renderer>())
		{			
			r.material.color = col;
		}

	}
开发者ID:guozanhua,项目名称:kinect-oculus-demo,代码行数:13,代码来源:RandomHSV.cs

示例6: RGBCircle

    public static Color RGBCircle(Color c, string label, Texture2D colorCircle)
    {
        var r = GUILayoutUtility.GetAspectRect(1);
        r.height = r.width -= 15;
        var r2 = new Rect(r.x + r.width + 5, r.y, 10, r.height);
        var hsb = new HSBColor(c);//It is much easier to work with HSB colours in this case


        var cp = new Vector2(r.x + r.width / 2, r.y + r.height / 2);

        if (Input.GetMouseButton(0))
        {
            var InputVector = Vector2.zero;
            InputVector.x = cp.x - Event.current.mousePosition.x;
            InputVector.y = cp.y - Event.current.mousePosition.y;

            var hyp = Mathf.Sqrt((InputVector.x * InputVector.x) + (InputVector.y * InputVector.y));
            if (hyp <= r.width / 2 + 5)
            {
                hyp = Mathf.Clamp(hyp, 0, r.width / 2);
                float a = Vector3.Angle(new Vector3(-1, 0, 0), InputVector);

                if (InputVector.y < 0)
                {
                    a = 360 - a;
                }

                hsb.h = a / 360;
                hsb.s = hyp / (r.width / 2);
            }
        }

        var hsb2 = new HSBColor(c);
        hsb2.b = 1;
        var c2 = hsb2.ToColor();
        GUI.color = c2;
        hsb.b = GUI.VerticalSlider(r2, hsb.b, 1.0f, 0.0f, "BWSlider", "verticalsliderthumb");

        GUI.color = Color.white * hsb.b;
        GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 1);
        GUI.Box(r, colorCircle, GUIStyle.none);

        var pos = (new Vector2(Mathf.Cos(hsb.h * 360 * Mathf.Deg2Rad), -Mathf.Sin(hsb.h * 360 * Mathf.Deg2Rad)) * r.width * hsb.s / 2);

        GUI.color = c;
        GUI.Box(new Rect(pos.x - 5 + cp.x, pos.y - 5 + cp.y, 10, 10), "", "ColorcirclePicker");
        GUI.color = Color.white;

        c = hsb.ToColor();
        return c;
    }
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:51,代码来源:GUIControls.cs

示例7: CreateLanes

    void CreateLanes()
    {
        lanes = new List<Lane>(numberOfLanes);

        for (int i = 0; i < numberOfLanes; i++) {
            var lane = Instantiate(lanePrefab, Vector3.zero, Quaternion.identity) as Lane;
            //lane.GetComponent<tk2dSprite>().color = lerpPoints.GetRangeValue((float)i/(float)numberOfLanes);
            float h = Mathf.Lerp(hueBottom, hueTop, (float)i / (float)numberOfLanes);
            var hsb = new HSBColor(0.6f, h, 1.0f, 0.3f);
            lane.GetComponent<tk2dSprite>().color = hsb.ToColor();
            lane.transform.parent = transform;
            lane.transform.localPosition = new Vector3(0, i * laneDistance, i * zLaneDistance);
            lanes.Add(lane);
        }
    }
开发者ID:mjewkes,项目名称:SpaceRaceCollab,代码行数:15,代码来源:LaneManager.cs

示例8: OnEnable

    private void OnEnable()
    {
      HSBColor hsbColor = new HSBColor();
      hsbColor.h = UnityEngine.Random.value;
      hsbColor.s = 1.0f;
      hsbColor.b = 1.0f;

      Color color = hsbColor.ToColor();
      color.a = 1.0f;

      Light light = gameObject.GetComponent<Light>();
      light.color = color;

      SpriteRenderer spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
      spriteRenderer.color = color;

      sun = GameObject.FindObjectOfType<Sun>();
    }
开发者ID:zacharymacleod,项目名称:Betrayer,代码行数:18,代码来源:Flare.cs

示例9: ColorCombine

	private Color ColorCombine(Color a, Color b)
	{
		/*if (a == Color.white)
        {
            a = Color.black;
        }
        Color res = new Color();
        float fr = 1f;
        float fg = 1f;
        float fb = 1f;

        if (a.r + b.r > 1)
        {
            fr = 2.0f;
        }
        if (a.g + b.g > 1)
        {
            fg = 2.0f;
        }
        if (a.b + b.b > 1)
        {
            fb = 2.0f;
        }
        res.r = (a.r + b.r) / fr;
        res.g = (a.g + b.g) / fg;
        res.b = (a.b + b.b) / fb;
        res.a = 1.0f;
        return res;
*/
		if (a == Color.white)
		{
			return b;
		}
		if (b == Color.white)
		{
			return a;
		}
		HSBColor hsbA = HSBColor.FromColor(a);
		HSBColor hsbB = HSBColor.FromColor(b);
		
		HSBColor res = new HSBColor(0.5f * (hsbA.h + hsbB.h), hsbB.s, hsbB.b);
		return res.ToColor();
	}
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:43,代码来源:UIWindowFireworkGuide.cs

示例10: RGBCircle

    public static Color RGBCircle( Color c ,  string label, float w_, float h_)
    {
        Rect r = new Rect();
        //if(Event.current.type == EventType.Repaint){
        Rect rect = GUILayoutUtility.GetLastRect();
        r = new Rect(rect.x,rect.y+rect.height+2, w_, h_);
        //}

        Rect r2 = new Rect(r.x + r.width +5, r.y, 10, r.height);
        HSBColor hsb = new HSBColor (c);//It is much easier to work with HSB colours in this case

        Vector2 cp = new Vector2 (r.x + r.width/2, r.y + r.height/2);

        if (Input.GetMouseButton (0) && r.x > 0) {// r.x > 0  inok hack

            Vector2 InputVector = Vector2.zero;
            InputVector.x = cp.x - Event.current.mousePosition.x;
            InputVector.y = cp.y - Event.current.mousePosition.y;

            float hyp = Mathf.Sqrt( (InputVector.x * InputVector.x) + (InputVector.y * InputVector.y) );
            if (hyp <= r.width/2 + 5) {
                hyp = Mathf.Clamp (hyp,0,r.width/2);
                float a = Vector3.Angle(new Vector3(-1,0,0), InputVector);

                if (InputVector.y<0) {
                    a = 360 - a;
                }

                hsb.h = a / 360;
                hsb.s = hyp / (r.width/2);
            }
        }

        HSBColor hsb2 = new HSBColor (c);
        hsb2.b = 1;
        Color c2 = hsb2.ToColor ();

        //hsb.b = GUI.VerticalSlider (r2,hsb.b,1.0f,0.0f,"BWSlider","verticalsliderthumb");
        hsb.b = GUI.VerticalSlider (r2, hsb.b,1.0f,0.0f);

        GUI.color = c2;

        Color guiColor = Color.white * hsb.b;
        guiColor.a = 1.0f;
        GUI.color = guiColor;

        GUILayout.Box("", GUIStyle.none, GUILayout.Width(r.width), GUILayout.Height(r.height));//dummySize
        //GUI.Box(r, colorCircle, GUIStyle.none);
        GUI.Box(r, "", "colorCircle");

        float w = r.width;

        Vector2 pos = (new Vector2 (Mathf.Cos (hsb.h*360*Mathf.Deg2Rad), -Mathf.Sin (hsb.h*360*Mathf.Deg2Rad))* w *hsb.s/2);

        GUI.color = c;
        GUI.Box(new Rect(pos.x-5+cp.x, pos.y-5+cp.y, 10, 10),"","ColorcirclePicker");
        //GUI.Box(new Rect(cp.x, cp.y, 10, 10),"","ColorcirclePicker");

        c = hsb.ToColor ();

        //GUILayout.Label(getWhiteTexture(), style, GUILayout.ExpandWidth(true));

        // color chip
        GUIStyle style = new GUIStyle();
        style.stretchWidth = true;
        style.normal.background = GUILayoutExtra.getWhiteTexture();
        style.margin = new RectOffset(0,0,5,5);

        Rect r3 = r2;
        r3.x += r2.width + 10;
        //GUI.Label(r3, GUILayoutExtra.getWhiteTexture(), style);
        GUI.Label(r3, " ", "ColorChip");
        GUI.color = Color.white;
        return c;
    }
开发者ID:inoook,项目名称:EffectShader,代码行数:75,代码来源:GUIControls.cs

示例11: UpdateColor

 public void UpdateColor()
 {
     //Vector3 direction = _parentObj.position - _transform.position;
     float angle = Vector3.Angle(Vector3.up, _transform.position);
     HSBColor newColor = new HSBColor(Mathf.Sin (angle + Mathf.PI / 2 ), 1f, 1f);
     _material.color = newColor.ToColor();
 }
开发者ID:kelvinlkf,项目名称:GGJ2016,代码行数:7,代码来源:PlayerScript.cs

示例12: LerpColor

 public void LerpColor()
 {
     HSBColor newColor = new HSBColor(Mathf.Sin (Random.Range(0f, 360f) + Mathf.PI / 2 ), 1f, 1f);
     _material.DOColor(newColor.ToColor(), delayDuration);
     _lineRenderer.material.DOColor(newColor.ToColor(), delayDuration);
 }
开发者ID:kelvinlkf,项目名称:GGJ2016,代码行数:6,代码来源:PlayerScript.cs

示例13: OnColorChange

	void OnColorChange(HSBColor color) 
	{
        this.color = color.ToColor();
	}
开发者ID:KingCrazy,项目名称:cubeShooter,代码行数:4,代码来源:ExampleColorReceiver.cs


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