スクリプト事例ー色相を動的に変更する
PNUで使用したコルーチンの中身
private IEnumerator hotaru() {
Debug.Log ("start rainbow");
while (true) {
//Debug.Log (destColor);
float myHue = 0;
currentColor = Color.HSVToRGB (0.5f, 1f, 1f);
destColor = Color.HSVToRGB (myHue, 1f, 1f);
// t += (Time.deltaTime) / duration;
// Camera.main.backgroundColor = Color.Lerp (currentColor, destColor, t);
// if (t > 1.0) {
// currentColor = destColor;
// }
yield return new WaitForSeconds (1.0f);//color hold time
t = 0;
if (myHue > 1.0f) {
myHue = 0;
} else {
myHue += 0.2f;
}
}
}
