Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var count : int;
- var countText : GUIText;
- var winText : GUIText;
- var jumpheight : float;
- var myTimer : float = 5.0;
- var display : GUIText;
- function Start()
- {
- count = 0;
- countText.text = "Counter: " + count.ToString();
- winText.text = " ";
- }
- function FixedUpdate () {
- var horizontal : float = Input.GetAxis("Horizontal");
- var vertical : float = Input.GetAxis("Vertical");
- var speed : float = 3;
- rigidbody.AddForce(Vector3(horizontal*speed,0,vertical*speed));
- if (Input.GetButton("Jump")) {
- Jump();
- }
- if(myTimer > 0){
- myTimer -= Time.deltaTime;
- var postedTime = Mathf.Floor(myTimer);
- display.text = "Time Remaining: " + postedTime;
- }
- if(myTimer <= 0){
- //do something!
- }
- }
- // Destroy everything that enters the trigger
- function Jump() {
- rigidbody.AddForce(Vector3.up * jumpheight);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement