void UguiShow() { CoinNumberText.GetComponent <Text> ().text = "" + CoinNumber; EndRunDistanceText.GetComponent <Text> ().text = "" + Mathf.FloorToInt(Cowboy.transform.position.z); EndCoinNumberText.GetComponent <Text> ().text = "" + CoinNumber; EndRunDistanceText.GetComponent <Text> ().text = "" + Mathf.FloorToInt(Cowboy.transform.position.z); Score = CoinNumber * 10 + Mathf.FloorToInt(Cowboy.transform.position.z); EndScoreText.GetComponent <Text> ().text = "" + Score; }
//UI 顯示 void UGUIShow() { //顯示當前獲得金幣數量 CoinNumberText.GetComponent <Text> ().text = "" + CoinNumber; //顯示牛仔跑步的距離 RunDistanceText.GetComponent <Text> ().text = "" + Mathf.FloorToInt(Cowboy.transform.position.z); //闖關失敗介面顯示獲得金幣數量 EndCoinNumberText.GetComponent <Text>().text = "" + CoinNumber; //闖關失敗介面顯示牛仔跑步的距離 EndRunDistanceText.GetComponent <Text> ().text = "" + Mathf.FloorToInt(Cowboy.transform.position.z); //得分計算方式為, 獲得金幣數量 x10 + 無條件捨去牛仔移動 z 軸的距離 Score = CoinNumber * 10 + Mathf.FloorToInt(Cowboy.transform.position.z); EndScoreText.GetComponent <Text> ().text = "" + Score; }