trò chơi game bóng rổ full code
33.516 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3
4 public class HUDController : MonoBehaviour {
5
6 public GUIText Score;
7 public GUIText BallsLeftText;
8 public GUIText ScoreText;
9 public GUITexture Logomarca;
10 public GUIText BallsLeft;
11
12 // Use this for initialization
13 void Start () {
14 int scWidth = Screen.width;
15
16 if (scWidth > 1200) {
17 Score.transform.position = new Vector3 (Score.transform.position.x-0.05f, Score.transform.position.y, Score.transform.position.z);
18 Score.fontSize = 80;
19 ScoreText.transform.position = new Vector3 (ScoreText.transform.position.x-0.02f, ScoreText.transform.position.y, ScoreText.transform.position.z);
20 ScoreText.fontSize = 140;
21 BallsLeft.transform.position = new Vector3 (BallsLeft.transform.position.x-0.05f, BallsLeft.transform.position.y, BallsLeft.transform.position.z);
22 BallsLeft.fontSize = 80;
23 BallsLeftText.transform.position = new Vector3 (BallsLeftText.transform.position.x-0.02f, BallsLeftText.transform.position.y, BallsLeftText.transform.position.z);
24 BallsLeftText.fontSize = 140;
25 }
26
27 //(Screen.height / defaultScreenSize) * defaultFontSize
28
29 // GUI.Label (new Rect (scWidth/2.6f, scHeigth/7, scWidth/4, scHeigth/4), msgTexture);
30 }
31
32 // Update is called once per frame
33 void Update () {
34
35 }
36 }
2 using System.Collections;
3
4 public class HUDController : MonoBehaviour {
5
6 public GUIText Score;
7 public GUIText BallsLeftText;
8 public GUIText ScoreText;
9 public GUITexture Logomarca;
10 public GUIText BallsLeft;
11
12 // Use this for initialization
13 void Start () {
14 int scWidth = Screen.width;
15
16 if (scWidth > 1200) {
17 Score.transform.position = new Vector3 (Score.transform.position.x-0.05f, Score.transform.position.y, Score.transform.position.z);
18 Score.fontSize = 80;
19 ScoreText.transform.position = new Vector3 (ScoreText.transform.position.x-0.02f, ScoreText.transform.position.y, ScoreText.transform.position.z);
20 ScoreText.fontSize = 140;
21 BallsLeft.transform.position = new Vector3 (BallsLeft.transform.position.x-0.05f, BallsLeft.transform.position.y, BallsLeft.transform.position.z);
22 BallsLeft.fontSize = 80;
23 BallsLeftText.transform.position = new Vector3 (BallsLeftText.transform.position.x-0.02f, BallsLeftText.transform.position.y, BallsLeftText.transform.position.z);
24 BallsLeftText.fontSize = 140;
25 }
26
27 //(Screen.height / defaultScreenSize) * defaultFontSize
28
29 // GUI.Label (new Rect (scWidth/2.6f, scHeigth/7, scWidth/4, scHeigth/4), msgTexture);
30 }
31
32 // Update is called once per frame
33 void Update () {
34
35 }
36 }
Use this for initialization
(Screen.height defaultScreenSize) * defaultFontSize
GUI.Label (new Rect (scWidth2.6f, scHeigth7, scWidth4, scHeigth4), msgTexture);
Update is called once per frame