Collision

Published on February 2017 | Categories: Documents | Downloads: 53 | Comments: 0 | Views: 573
of 1
Download PDF   Embed   Report

Comments

Content

using UnityEngine;
using System.Collections;
public class collision : MonoBehaviour {
public int vie = 1;
public GUIText gt ;
public GUIText gameover;
void OnTriggerEnter(Collider other){
if (other.gameObject.tag == "Bus") {
Destroy (other.gameObject);
vie=vie-1;
gt.text = "vie:" + vie;
}
if (other.gameObject.tag == "car") {
vie=vie-1;
Destroy(other.gameObject);
}
}
void Update () {
gt.text = "vie:" + vie;
if (vie <= 0) {
gameover.enabled=true;
Time.timeScale=0;
}
if (Input.GetKey (KeyCode.Escape)) {
if(ispaused){
ispaused =false;
Time.timeScale=1;
}
else {
}
}
}
/*void OnGUI(){
if(vie<=0){
if (GUI.Button(new Rect(Screen.width/2,70,100,30),"RECOM
MENCER")){
Application.loadedLevel(0);
Time.timeScale=1;
vie=1;
}
}
}*/
}

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close