- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
using UnityEngine;
using System.Collections;
public class ColorChange : MonoBehaviour {
private int display = 1;
// Use this for initialization
void Start () {
StartCoroutine(***sh());
}
// Update is called once per frame
void Update () {
}
IEnumerator ***sh(){
while(***e){
display = 1;
yield return new WaitForSeconds(1.0f);
display = 2;
yield return new WaitForSeconds(1.0f);
display = 3;
yield return new WaitForSeconds(1.0f);
display = 4;
yield return new WaitForSeconds(1.0f);
display = 5;
yield return new WaitForSeconds(1.0f);
display = 6;
yield return new WaitForSeconds(1.0f);
display = 7;
yield return new WaitForSeconds(1.0f);
}
}
void OnGUI(){
switch(display){
case 1:
transform.renderer.material.color = Color.green;
break;
case 2:
transform.renderer.material.color = Color.red;
break;
case 3:
transform.renderer.material.color = Color.yellow;
break;
case 4:
transform.renderer.material.color = Color.blue;
break;
case 5:
transform.renderer.material.color = Color.grey;
break;
case 6:
transform.renderer.material.color = Color.magenta;
break;
case 7:
transform.renderer.material.color = Color.cyan;
break;
}
}
} |
|