标签:
1 using UnityEngine; 2 using System.Collections; 3 4 public class pipe : MonoBehaviour { 5 void Start() { 6 RandomGeneratePosition(); 7 } 8 public void RandomGeneratePosition() { 9 float pos_y = Random.Range(-0.2f, 0.1f); 10 this.transform.localPosition = new Vector3(this.transform.localPosition.x, 11 pos_y, this.transform.localPosition.y); 12 } 13 14 //计分 15 void OnTriggerExit(Collider other) { 16 if (other.tag == "Player") 17 { 18 audio.Play(); 19 GameMangger._intance.score++; 20 } 21 } 22 23 //显示分数的文字 24 void OnGUI() { 25 GUILayout.Label("Score:" + GameMangger._intance.score); 26 } 27 28 }
标签:
原文地址:http://www.cnblogs.com/wry524/p/4947823.html