Unity3d-打飞机:处理子弹
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
public float speed=2f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.transform .Translate (Vector3 .up * speed * Time.deltaTime);//移动当前物体
if (transform .position .y > 5.6f) {
Destroy (this.gameObject ); //销毁当前物体
}
}
}