void OnTriggerEnter(Collider other) { if (!other.attachedRigidbody) { return; } if (other.attachedRigidbody.isKinematic) { return; } //Add caught object to the list SC_Caught caught = other.GetComponent <SC_Caught>(); if (!caught) { caught = other.gameObject.AddComponent <SC_Caught>(); } caught.Init(this, r, tornadoStrength); if (!caughtObject.Contains(caught)) { caughtObject.Add(caught); } }
void OnTriggerExit(Collider other) { //Release caught object SC_Caught caught = other.GetComponent <SC_Caught>(); if (caught) { caught.Release(); if (caughtObject.Contains(caught)) { caughtObject.Remove(caught); } } }