Advertisement
LittleAngel

Class Temp 2

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