public void OnCollide(SCollisionInfo collInfo) { if (collInfo.otherObj.tag == "Bug") { FlyAI fly = collInfo.otherObj.GetComponent <FlyAI> (); if (fly != null) { fly.DropFly(); } Destroy(this.gameObject); } }
void Awake() { fAI = gameObject.GetComponentInParent<FlyAI> (); }