public void OnTriggerExit2D(Collider2D collision) { ISpeedChangable s = collision.GetComponent <ISpeedChangable>(); if (s != null) { EffectedBodies.Remove(s); } }
public void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.scene != this.gameObject.scene) { return; } ISpeedChangable s = collision.GetComponent <ISpeedChangable>(); if (s != null) { EffectedBodies.Add(s); } }