Welcome!

Welcome to our community forums, full of great people, ideas and excitement. Please register if you would like to take part.

This is extra text with a test link..

Register Now

Announcement

Collapse
No announcement yet.

Gun Overheat Color GUI Fade

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gun Overheat Color GUI Fade

    For Alex

    Code:
    private var startingColor : Color;
    
    function Awake()
    {
    	//Get the original color value of the GUI
    	startingColor = guiTexture.color;	
    }
    
    function Update() {
    	//When the mouse is down, transition from whatever color the guitTexture is currently at to the color red (Color (1,0,0)
    	if (Input.GetMouseButton(0))
    	{
    		guiTexture.color = Color.Lerp(guiTexture.color, Color (1,0,0), Time.time * .001);
    	}
    	//When the mouse is not down, check to see if the current color's red channel is more than the starting color's red.  If it is, lerp back to the starting color
    	else
    	{
    		if (guiTexture.color.r > startingColor.r)
    		{
    			guiTexture.color = Color.Lerp(guiTexture.color, startingColor, Time.time * .001);
    		}
    	}
    }
Working...
X