Skip to content

Commit

Permalink
Part 6 - Displaying Text
Browse files Browse the repository at this point in the history
  • Loading branch information
Maryadi committed May 26, 2017
1 parent abffced commit a96ce36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Assets/Scripts/SphereController.cs
Expand Up @@ -6,10 +6,22 @@ public class SphereController : MonoBehaviour {

private Rigidbody rb;
public float speed;
public GUIText score;
public GUIText win;
private int targetHit;

private void showText() {
score.text = "Point : "+targetHit.ToString ();
if (targetHit >= 13) {
win.text = "Congratulations...!\n You Wiiin...!";
}
}
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody> ();
targetHit = 0;
win.text = "";
showText ();
}

// Update is called once per frame
Expand All @@ -34,6 +46,8 @@ public class SphereController : MonoBehaviour {
//After ball hit the cube, we hide the cube and destroy FlareObj
Destroy(FlareObj, 7);
obj.gameObject.SetActive (false);
targetHit++; //Increment by one when one cube is hit
showText();
}
}
}

0 comments on commit a96ce36

Please sign in to comment.