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


C# Material.SetColor方法代码示例

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


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

示例1: GenerateWireframeMeshsAndMaterials

	private void GenerateWireframeMeshsAndMaterials() {
		foreach (MeshNMaterial subObj in subObjects) {
			//添加AmazingWireframeGenerator
			subObj.gameObject.AddComponent<TheAmazingWireframeGenerator>();
			for (int i = 0;i < subObj.originalMaterials.Length;i++) {
				Material wireframeNoTexMat = new Material(
					Shader.Find("VacuumShaders/The Amazing Wireframe/Unlit/NoTex"));
				wireframeNoTexMat.SetColor("_Color", subObj.originalMaterials[i].GetColor("_Color"));
				wireframeNoTexMat.EnableKeyword("V_WIRE_ANTIALIASING_ON");
				wireframeNoTexMat.EnableKeyword("V_WIRE_LIGHT_ON");
				subObj.wireframeNoTexMaterials[i] = wireframeNoTexMat;
				Material wireframeTexMat = new Material(
						Shader.Find("VacuumShaders/The Amazing Wireframe/Deferred/Bumped Specular"));
				wireframeTexMat.SetColor("_Color", subObj.originalMaterials[i].GetColor("_Color"));
				if (subObj.originalMaterials[i].HasProperty("_SpecColor"))
					wireframeTexMat.SetColor("_SpecColor", subObj.originalMaterials[i].GetColor("_SpecColor"));
				if (subObj.originalMaterials[i].HasProperty("_Shininess"))
					wireframeTexMat.SetFloat("_Shininess", subObj.originalMaterials[i].GetFloat("_Shininess"));
				wireframeTexMat.SetTexture("_MainTex", subObj.originalMaterials[i].GetTexture("_MainTex"));
				if (subObj.originalMaterials[i].HasProperty("_BumpMap"))
					wireframeTexMat.SetTexture("_BumpMap", subObj.originalMaterials[i].GetTexture("_BumpMap"));
				wireframeTexMat.EnableKeyword("V_WIRE_ANTIALIASING_ON");
				wireframeTexMat.EnableKeyword("V_WIRE_LIGHT_ON");
				subObj.wireframeTexMaterials[i] = wireframeTexMat;
			}
		}
	}
开发者ID:AmaranthYan,项目名称:theArena,代码行数:27,代码来源:FocusableWeaponComponent.cs

示例2: PathController

        public PathController(QueryTool tool)
        {
            queryTool = tool;
            currentHighlightType = HighlightType.None;

            Config.instance.eventConfigChanged += () => { OnConfigChanged(); };

            Log.info("Load Line Material...");

            Color red = new Color(1, 0, 0);
            Color gold = new Color(1, 0.9f, 0);

            string lineShader = ResourceLoader.loadResourceString("Materials/Shaders/TransparentVertexLit.shader");

            lineMaterial = new Material(lineShader);
            lineMaterial.color = red;
            lineMaterial.SetColor("_Emission", red);
            lineMaterial.SetColor("_SpecColor", Color.black); //Disable shine effect
            lineMaterial.mainTexture = ResourceLoader.loadTexture("Materials/NewSkin.png");
            lineMaterial.renderQueue = 100;

            lineMaterialHighlight = new Material(lineMaterial);
            lineMaterialHighlight.color = gold;
            lineMaterialHighlight.SetColor("_Emission", gold);
            lineMaterial.renderQueue = 101;

            Texture pin = ResourceLoader.loadTexture("Materials/Pin.png");

            activeSegmentIndicator = Billboard.Create(Billboard.CreateSpriteMaterial(pin, Color.green));
            vehicleIndicator = Billboard.CreateSpriteMaterial(pin, red);
            vehicleIndicatorHighlight = Billboard.CreateSpriteMaterial(pin, gold);

            Log.debug("PathController initialized");
        }
开发者ID:akira-ishizaki,项目名称:TrafficReport,代码行数:34,代码来源:PathController.cs

示例3: Awake

 void Awake()
 {
     material = new Material(Shader.Find("Hidden/ChannelMixer"));
     material.SetColor("_R", RGB[0, 0]);
     material.SetColor("_G", RGB[0, 1]);
     material.SetColor("_B", RGB[0, 2]);
 }
开发者ID:Nachtrind,项目名称:Fungus,代码行数:7,代码来源:ColorBlindFilter.cs

示例4: Start

    void Start()
    {
        var granny = GameObject.Find("Granny");

        if (granny != null)
        {
            grannyCollider = granny.GetComponent<Collider2D>();
            itemUse = granny.GetComponent<ItemUse>();
        }

        var spriteRenderer = GetComponent<SpriteRenderer>();

        if (materials == null)
        {
            var effectsCount = Enum.GetNames(typeof(Effect)).Length;

            materials = new Material[effectsCount];

            materials[0] = spriteRenderer.material;

            for (int i = 1; i < effectsCount; i++)
            {
                var randomMaterial = new Material(spriteRenderer.material);

                randomMaterial.SetColor("_ColorR", Utils.RandomHueColor());
                randomMaterial.SetColor("_ColorG", Utils.RandomHueColor());
                randomMaterial.SetColor("_ColorB", Color.white);

                materials[i] = randomMaterial;
            }
        }

        spriteRenderer.material = getMaterial(PillEffect);
    }
开发者ID:samowski,项目名称:SuperGameProjectofAwesome,代码行数:34,代码来源:Pill.cs

示例5: Awake

 void Awake()
 {
     material = new Material( Shader.Find("Hidden/Gradient") );
     material.SetColor("_ColorA", colorA);
     material.SetColor("_ColorB", colorB);
     material.SetColor("_ColorC", colorC);
 }
开发者ID:leon196,项目名称:UnityVJ,代码行数:7,代码来源:GradientFilter.cs

示例6: Start

	void Start () {

		if(PlayerPrefs.GetInt(Application.loadedLevelName + "Door" + id) == 0){
			open = false;
		}else{
			open = true;
		}

		mat = GetComponent<MeshRenderer>().material;

		if(bodenschalter.Length == 1){
			onColor = bodenschalter[0].onColor;
			offColor = bodenschalter[0].offColor;
		}

		if(open){
			mat.SetColor("_Color", onColor);
		}else{
			mat.SetColor("_Color", offColor);
		}

		switch(openDirection){
			case DoorDirection.UP: endpos = transform.position + transform.up*openDistance*5.5f; break;
			case DoorDirection.DOWN: endpos = transform.position - transform.up*openDistance*5.5f; break;
			case DoorDirection.LEFT: endpos = transform.position - transform.right*openDistance*5.5f; break;
			case DoorDirection.FWD: endpos = transform.position + transform.forward*openDistance*5.5f; break;
			case DoorDirection.BWD: endpos = transform.position - transform.forward*openDistance*5.5f; break;
			default: endpos = transform.position + transform.right*openDistance*5.5f; break;
		}

		startpos = transform.position;
	
	}
开发者ID:yzeal,项目名称:Weltenseele2,代码行数:33,代码来源:Door.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        //countdown = transform.parent.parent.GetComponent<Countdown>();

        countdown = transform.parent.GetComponent<Countdown>();

        renderer = GetComponent<Renderer>();
        material = renderer.material;

        if (red) {
            material.SetColor("_EmissionColor", Color.grey);
            myColor = Color.red;
            signal = Countdown.signal.RED;
        }
        if (yellow) {
            material.SetColor("_EmissionColor", Color.grey);
            myColor = Color.yellow;
            signal = Countdown.signal.YELLOW;
        }
        if (green) {
            material.SetColor("_EmissionColor", Color.grey);
            myColor = Color.green;
            signal = Countdown.signal.GREEN;
        }
        material.SetFloat("_EmissionScaleUI", 0.1f);
    }
开发者ID:Rarau,项目名称:racing_game,代码行数:27,代码来源:OnLight.cs

示例8: BallDestroy

    //ball is destoryed because it got stuck in the wall
    void BallDestroy()
    {
        Material particleColor = new Material(shotColor);
        if (colorShot == 0)//if ball is green increase greenshots by one
        {
            gVar.greenShots++;
            particleColor.SetColor("_EmissionColor", GREEN);
        }
        else if (colorShot == 1)
        {
            gVar.redShots++;
            particleColor.SetColor("_EmissionColor", RED);
        }
        else if (colorShot == 2)
        {
            gVar.blueShots++;
            particleColor.SetColor("_EmissionColor", BLUE);
        }
        else if (colorShot == 3)
        {
            gVar.purpleShots++;
            particleColor.SetColor("_EmissionColor", PURPLE);
        }

        GameObject particles = (GameObject)Instantiate(ballParticleSystem, this.GetComponent<Transform>().position, Quaternion.identity);
        particles.GetComponent<Renderer>().material = particleColor;
        Destroy(particles, 0.5f);
        Destroy(gameObject);
    }
开发者ID:rebeccaansems,项目名称:Alieball,代码行数:30,代码来源:Rocket.cs

示例9: Test

	IEnumerator Test( Material mat, Color newColor )
	{
		Color orgColor = mat.GetColor("_EmissionColor");
		mat.SetColor("_EmissionColor", newColor);
		yield return new WaitForSeconds(0.5f);
		mat.SetColor("_EmissionColor", orgColor);
	}
开发者ID:frzpop,项目名称:RubberHookshot,代码行数:7,代码来源:InputManager.cs

示例10: ChangeColor

    /// <summary>
    /// Changes the color of the given material
    /// </summary>
    /// <param name="material"></param>
    /// <param name="color"></param>
    public IEnumerator ChangeColor(Material material, Color color, float seconds)
    {
        Color currentColor = material.GetColor("_EmissionColor");
        material.SetColor("_EmissionColor", color);
        yield return new WaitForSeconds(seconds);

        // Reset color to initial one
        if (seconds > 0) { material.SetColor("_EmissionColor", currentColor); }
    }
开发者ID:FeedJonathanFoundation,项目名称:ubisoft-game-lab,代码行数:14,代码来源:MaterialExtensions.cs

示例11: Start

 public void Start()
 {
     fxRes = GetComponent<IndieEffects>();
     mat = new Material(shader);
     mat.SetColor("_Lift", Lift);
     mat.SetFloat("_LiftB", Mathf.Clamp(LiftBright, 0f, 2f));
     mat.SetColor("_Gamma", Gamma);
     mat.SetFloat("_GammaB", Mathf.Clamp(GammaBright, 0f, 2f));
     mat.SetColor("_Gain", Gain);
     mat.SetFloat("_GainB", Mathf.Clamp(GainBright, 0f, 2f));
 }
开发者ID:GreatArcStudios,项目名称:UnityIndieEffects,代码行数:11,代码来源:ColorBalance.cs

示例12: attackobject

	// Update is called once per frame
	IEnumerator attackobject() {
        yield return new WaitForEndOfFrame();
       mat = transform.GetChild(0).gameObject.GetComponent<MeshRenderer>().material;
        while (true)
        {
            mat.SetColor("_TintColor",new Color(0.3f,0.3f,0.3f));
            yield return new WaitForSeconds(Random.value/10);
            mat.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f));
            yield return new WaitForSeconds(Random.value);
        }
	
	}
开发者ID:MilindNilekani,项目名称:Athena,代码行数:13,代码来源:attackenemyui.cs

示例13: Start

	void Start () {

		mat = GetComponentInChildren<MeshRenderer>().material;

		if(bodenschalter.Length > 0){
			onColor = bodenschalter[0].onColor;
			offColor = bodenschalter[0].offColor;
		}

		if(on){
			mat.SetColor("_Color", onColor);
		}else{
			mat.SetColor("_Color", offColor);
		}
	}
开发者ID:yzeal,项目名称:Weltenseele2,代码行数:15,代码来源:Hinweis.cs

示例14: FadeIn

    //fades the buttons in as well
    IEnumerator FadeIn(Material material, float fadeSpeed)
    {
        Color tempColor = material.color;
          tempColor.a = 0;
          material.SetColor ("_Color", tempColor);

          while (material.color.a < 1) {

        tempColor.a += fadeSpeed;
        material.SetColor ("_Color", tempColor);

        yield return null;

          }
    }
开发者ID:connor-a-smith,项目名称:VR-Hub,代码行数:16,代码来源:MainEyeButton.cs

示例15: _FadeOut

 protected IEnumerator _FadeOut(Material m, float time)
 {
     var c = m.GetColor(Outline);
     var startAlpha = c.a;
     var start = Time.time;
     var end = start + time;
     while(Time.time <= end) {
         var progress = Mathf.InverseLerp(start, end, Time.time);
         var alpha = Mathf.Lerp(startAlpha, 0, progress);
         m.SetColor(Outline, SetAlpha(c, alpha));
         yield return new WaitForEndOfFrame();
     }
     m.SetColor(Outline, SetAlpha(c, 0));
     _fadingOut.Remove(m);
 }
开发者ID:nkf,项目名称:gamedev2014_20minexp,代码行数:15,代码来源:InvokableAction.cs


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