界面就是一个分数一个生命值,
这是生命
public GameObject tank;//这个是自己哦
private TankController tc;
void Start () {
tc = tank.GetComponent<TankController>();
}
void Update () {}
void OnGUI()
{
GUI.skin.label.fontSize = 30;
GUI.color = Color.red;
string content = "生命 : " + tc.health.ToString ();
GUI.Label (new Rect(0,Screen.height/8,Screen.width/5,Screen.height/8),content);
}
这是分数:
public int score= 0;
void Start () {}
void Update () {}
void OnGUI()
{
GUI.skin.label.fontSize = 30;
GUI.color = Color.blue;
string content = "分数 : " + score.ToString ();
GUI.Label (new Rect(0,0,Screen.width/5,Screen.height/8),content);
}