Advertisement
LittleAngel

Class Temp

Jul 30th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. var speed = 1.0;
  2. private var count = 0;
  3.  
  4. function FixedUpdate () {
  5. if (Input.GetKey ("w")) rigidbody.AddForce (Vector3.forward * speed * Time.deltaTime);
  6. if (Input.GetKey ("s")) rigidbody.AddForce (-Vector3.forward * speed * Time.deltaTime);
  7. if (Input.GetKey ("a")) rigidbody.AddForce (-Vector3.right * speed * Time.deltaTime);
  8. if (Input.GetKey ("d")) rigidbody.AddForce (Vector3.right * speed * Time.deltaTime);
  9. }
  10.  
  11. function OnTriggerEnter (other : Collider) {
  12. if (other.gameObject.tag == "PickUp") {
  13. other.gameObject.active = false;
  14. count += 1;
  15. }
  16. }
  17.  
  18. function OnGUI () {
  19. GUI.Label (Rect (10, 10, 120, 20), "Collection Count: " + count);
  20. if (count >= 12)
  21. GUI.Label (Rect (Screen.width / 2 - 50, Screen.height / 3, 100, 20), "YOU WIN!");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement