using System.Collections; using System.Collections.Generic; using UnityEngine; public class BulletController : MonoBehaviour { public bool isMove = false; public bool isWRJFire = false; public GameObject boom; public HuoPaoController huoPaoController; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (isMove) transform.Translate(transform.forward * Time.deltaTime * 70f, Space.World); } public void SetBoolIsMove() { isMove = true; } private void OnCollisionEnter(Collision other) { Debug.Log("qwqw"); if (isWRJFire) { if (other.collider.name.Contains("火炮")) { GameObject go = Instantiate(boom, other.collider.transform.position, Quaternion.identity); Destroy(other.collider.gameObject); Destroy(gameObject); } } else { if (other.collider.name.Contains("无人机")) { if (other.collider.transform.childCount > 0) { GameObject go = Instantiate(boom, other.collider.transform.position, Quaternion.identity); Destroy(other.collider.transform.GetChild(0).gameObject); } else { huoPaoController.wrjs.Remove(other.collider.gameObject); Destroy(other.collider.gameObject); Debug.Log("无人机被消灭干净"); } Destroy(gameObject); } } } }