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


C# UnityEngine.Color32类代码示例

本文整理汇总了C#中UnityEngine.Color32的典型用法代码示例。如果您正苦于以下问题:C# Color32类的具体用法?C# Color32怎么用?C# Color32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SetColor

 public static void SetColor(this Slot slot, Color32 color)
 {
     slot.A = color.a / 255f;
     slot.R = color.r / 255f;
     slot.G = color.g / 255f;
     slot.B = color.b / 255f;
 }
开发者ID:Fensal,项目名称:FairJudgementBac,代码行数:7,代码来源:SkeletonExtensions.cs

示例2: WriteRgbaColor

		public void WriteRgbaColor(Color32 color)
		{
			Write(color.r);
			Write(color.g);
			Write(color.b);
			Write(color.a);
		}
开发者ID:Neproify,项目名称:ivmp,代码行数:7,代码来源:PlatformUnityExtras.cs

示例3: SerializedParticle

		public SerializedParticle (Vector3 position, 
		                           Vector3 velocity, 
		                           float rotation, 
		                           float size, 
		                           float lifetime, 
		                           float startLifetime, 
		                           float playgroundLife, 
		                           float playgroundStartLifetime, 
		                           float playgroundEndLifetime, 
		                           float playgroundLifetimeSubtraction, 
		                           Color32 color, 
		                           
		                           Vector3 sourcePosition,
		                           float startingSize
		                           )
		{
			this.position = position;
			this.velocity = velocity;
			this.rotation = rotation;
			this.size = size;
			this.lifetime = lifetime;
			this.startLifetime = startLifetime;
			this.playgroundLife = playgroundLife;
			this.playgroundStartLifetime = playgroundStartLifetime;
			this.playgroundEndLifetime = playgroundEndLifetime;
			this.playgroundLifetimeSubtraction = playgroundLifetimeSubtraction;
			this.color = color;
			
			this.sourcePosition = sourcePosition;
			this.startingSize = startingSize;
		}
开发者ID:sirgreensock,项目名称:FishTest,代码行数:31,代码来源:SerializedParticle.cs

示例4: drawBoxAt

 public void drawBoxAt(int leftSideX, int topSideY, int dimW, int dimH, Color32 useCol)
 {
     int left = leftSideX;
     int right = left+dimW;
     int top = topSideY;
     int bot = topSideY+dimH;
     if(left < 0) {
         left = 0;
     }
     if(top < 0) {
         top = 0;
     }
     if(right > screenWidth) {
         right = screenWidth;
     }
     if(bot > screenHeight) {
         bot = screenHeight;
     }
     for(int xp=left; xp <right; xp++) {
         for(int yp=top; yp <bot; yp++) {
             // paintThis.SetPixel(xp,yp,useCol);
             setBufferPixel(xp,yp,useCol);
         }
     }
 }
开发者ID:gamkedo-la,项目名称:Arcade88,代码行数:25,代码来源:PixelScreenLib.cs

示例5: ColorLerpUnclamped

		/// <summary>Lerps from one colour to another.</summary>
		private static Color32 ColorLerpUnclamped(Color32 c1,Color32 c2,float value){
			return new Color32 ((byte)(c1.r + (c2.r - c1.r)*value), 
								(byte)(c1.g + (c2.g - c1.g)*value), 
								(byte)(c1.b + (c2.b - c1.b)*value), 
								(byte)(c1.a + (c2.a - c1.a)*value)
								);
		}
开发者ID:KMarshland,项目名称:ChildrensHospitalApp,代码行数:8,代码来源:ImageResizer.cs

示例6: mBlock

 public mBlock(Color32 color)
 {
     this.r = color.r;
     this.g = color.g;
     this.b = color.b;
     solid = true;
 }
开发者ID:aksdad,项目名称:VoxelEngine,代码行数:7,代码来源:Block.cs

示例7: rgbToHsv

        public static HSVColor rgbToHsv(Color32 color)
        {
            HSVColor result=new HSVColor();
            float min,max,delta;
            float r = (float)color.r/255.0f;
            float g = (float)color.g/255.0f;
            float b = (float)color.b/255.0f;

            min = Mathf.Min(r,g,b);
            max = Mathf.Max(r,g,b);
            result.v = max;
            delta = max - min;

            if( max != 0 )
                result.s = delta / max;		// s
            else {
                // r = g = b = 0		// s = 0, v is undefined
                result.s = 0;
                result.h = -1;
                return result;
            }
            if( r == max )
                result.h = ( g - b ) / delta;		// between yellow & magenta
            else if( g == max )
                result.h = 2 + ( b - r ) / delta;	// between cyan & yellow
            else
                result.h = 4 + ( r - g ) / delta;	// between magenta & cyan
            result.h *= 60;				// degrees
            if( result.h < 0 )
                result.h += 360;
            result.h /=360;
            return result;
        }
开发者ID:happyjiahan,项目名称:colorus,代码行数:33,代码来源:ColorUtil.cs

示例8: Set

		public void Set(int index, Color32 color)
		{
			components[index + 0] = color.r;
			components[index + 1] = color.g;
			components[index + 2] = color.b;
			components[index + 3] = color.a;
		}
开发者ID:alex-carlson,项目名称:PixelitisGGJ,代码行数:7,代码来源:z_SplatWeight.cs

示例9: Slot

		//TODO probably can delete it
		public Slot (string bone, string slot, string attachment = null, Color32? color = null)
		{
			this.bone = bone;
			this.name = slot;
			this.defaultAttachmentName = attachment;
			this.color = color;
		}
开发者ID:josephowen,项目名称:FireHugs,代码行数:8,代码来源:Slot.cs

示例10: Update

 // Update is called once per frame
 void Update()
 {
     float TimePassed = (Time.time - TimeStarted) / FadeTime;
     int FadeValue;
     int StartValue = 255;
     int EndValue = 0;
     if (!IsForward) {
         StartValue = 0;
         EndValue = 255;
     }
     FadeValue = Mathf.RoundToInt (Mathf.Lerp (StartValue, EndValue, TimePassed));
     Color32 NewBackgroundColor = new Color32(MyBackgroundColor.r,MyBackgroundColor.g,MyBackgroundColor.b,
                                              (byte)(FadeValue));
     gameObject.GetComponent<Renderer> ().material.color = NewBackgroundColor;
     //Time.timeScale = 0;
     if (FadeValue == EndValue) {
         if (IsForward) {
             //Time.timeScale = 1;
             gameObject.SetActive (false);
         } else {
             TimeStarted = Time.time+TimeDelay;
             IsForward = true;
         }
     }
 }
开发者ID:xxcozzwozzaxx,项目名称:AsylumFULL,代码行数:26,代码来源:WallFader.cs

示例11: NoiseTexture

    void NoiseTexture(int size, bool mono)
    {
        var path = EditorUtility.SaveFilePanel("Save Noise Texture", "Assets", "noise" + size, "png");
        if (path != "") {
            var tex = new Texture2D(size, size, TextureFormat.ARGB32, false);
            var s2 = size * size;
            var cols = new Color32[s2];
            for (int i = 0; i < s2; ++i) {
                if (mono) {
                    var r = (byte)Random.Range(0, 256);
                    cols[i] = new Color32(r, r, r, 255);
                }
                else {
                    cols[i] = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), 255);
                }
            }
            tex.SetPixels32(cols);
            tex.Apply();
            System.IO.File.WriteAllBytes(path, tex.EncodeToPNG());
            AssetDatabase.Refresh();
            Object.DestroyImmediate(tex);
            path = "Assets" + path.Remove(0, Application.dataPath.Length);
            // tex = (Texture2D)AssetDatabase.LoadAssetAtPath(path, typeof(Texture2D));

            TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
            textureImporter.textureFormat = TextureImporterFormat.ARGB32;
            textureImporter.anisoLevel = 0;
            AssetDatabase.ImportAsset(path);

            // EditorUtility.CompressTexture(tex, TextureFormat.ARGB32, 0);
            //tex.format = TextureFormat.ARGB32;
        }
    }
开发者ID:ratkingsminion,项目名称:game-jam-base-code,代码行数:33,代码来源:RatKingTools.cs

示例12: ColorXml

 public ColorXml(Color32 c)
 {
     this.r = c.r;
     this.g = c.g;
     this.b = c.b;
     this.a = c.a;
 }
开发者ID:quangthinhnguyen,项目名称:Unity3d-AMCore,代码行数:7,代码来源:ColorExtension.cs

示例13: CreateColorPixel

 /// <summary>
 /// Creates a 1x1 texture
 /// </summary>
 /// <param name="Background">Color of the texture</param>
 /// <returns></returns>
 internal static Texture2D CreateColorPixel(Color32 Background)
 {
     Texture2D retTex = new Texture2D(1, 1);
     retTex.SetPixel(0, 0, Background);
     retTex.Apply();
     return retTex;
 }
开发者ID:Starwaster,项目名称:ModularFuelSystem,代码行数:12,代码来源:Styles.cs

示例14: Start

	void Start() {

		winter = new Color32(246, 243, 237, 255);
		spring = new Color32(170, 155, 42, 255);
		summer = new Color32(137, 182, 65, 255);
		autumn = new Color32(234, 157, 46, 255);

		int currentSecond = DateTime.Now.Second;

		Camera _camera = GameObject.Find ("Main Camera").GetComponent<Camera>();
		childRenderers = this.transform.FindChild ("RoadsideGrass").GetComponentsInChildren<Renderer>();

		foreach (Renderer childRenderer in childRenderers) {
			if (currentSecond < 15) {
				_camera.backgroundColor = winter;
				childRenderer.material.color = winter;
			} 
			else if (currentSecond < 30) {
				_camera.backgroundColor = spring;
				childRenderer.material.color = spring;
			}
			else if (currentSecond < 45) {
				_camera.backgroundColor = summer;
				childRenderer.material.color = summer;
			} 
			else {
				_camera.backgroundColor = autumn ;
				childRenderer.material.color = autumn;
			}
		}
	}
开发者ID:Ahere,项目名称:infinite-road,代码行数:31,代码来源:RoadSegmentBehavior.cs

示例15: fill4

    public void fill4(int x, int y, Color32 oldColor, Color32 newColor)
    {
        ArrayList stack = new ArrayList();

        stack.Add(new Vec2i(x,y));

        int emergency = 10000;

        while(stack.Count > 0 && emergency >= 0) {

            Vec2i pixel = (Vec2i)stack[stack.Count - 1];
            stack.RemoveAt(stack.Count - 1);

            if(canvas.GetPixel(pixel.x, pixel.y) == oldColor) {

                canvas.SetPixel(pixel.x, pixel.y, newColor);

                if(pixel.x + 1 < 96 && canvas.GetPixel(pixel.x + 1, pixel.y) == oldColor)
                    stack.Add(new Vec2i(pixel.x + 1, pixel.y));

                if(pixel.x - 1 >= 0 && canvas.GetPixel(pixel.x - 1, pixel.y) == oldColor)
                    stack.Add(new Vec2i(pixel.x - 1, pixel.y));

                if(pixel.y + 1 < 64 && canvas.GetPixel(pixel.x, pixel.y + 1) == oldColor)
                    stack.Add(new Vec2i(pixel.x, pixel.y + 1));

                if(pixel.y - 1 >= 0 && canvas.GetPixel(pixel.x, pixel.y - 1) == oldColor)
                    stack.Add(new Vec2i(pixel.x, pixel.y - 1));

            }

            emergency--;

        }
    }
开发者ID:jancc,项目名称:pixelartist,代码行数:35,代码来源:PixelArtistCanvas.cs


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