Game Development Reference
In-Depth Information
076
077 //Wait until next frame
078 yield return null;
079
080 //Update Time
081 ElapsedTime += Time.deltaTime;
082 }
083
084 //Apply final color
085 CamCols[1] = Color.Lerp(From, To, 1f);
086 }
087 //---------------------------------------
088 //Sample for testing camera functionality
089 //Press space bar to fade in and out between cameras
090 void Update()
091 {
092 //Fade camera in or out when space is pressed
093 if(Input.GetKeyDown(KeyCode.Space))
094 {
095 StopAllCoroutines();
096
097 //Should we fade out or in
098 if(CamCols[1].a <= 0f)
099 StartCoroutine(Fade(CamCols[1], new
Color(0.5f,0.5f,0.5f,1f), FadeTime));
//Fade in
100 else
101 StartCoroutine(Fade(CamCols[1], new
Color(0.5f,0.5f,0.5f,0f), FadeTime));
//Fade out
102 }
103 }
104 //---------------------------------------
105 }
 
Search WWH ::




Custom Search