using System.Collections; using System.Collections.Generic; using UnityEngine; public class bulletMove : MonoBehaviour { // Start is called before the first frame update void Start() { Invoke("selfdestory", 5); } // Update is called once per frame void Update() { float dz = 5 * Time.deltaTime; this.gameObject.transform.Translate(0, 0, dz, Space.Self); } void selfdestory() { Destroy(this.gameObject); } //感應觸發 private void OnTriggerEnter(Collider other) { if(other.gameObject.name =="monster(Clone)") { Destroy(this.gameObject); Destroy(other.gameObject); } } }