public void OnTriggerExit2D(Collider2D other) { ISnapable snapable = other.GetComponent <ISnapable>(); if (snapable == null) { return; } _snapable?.UnHighlight(); if (_snapable != snapable) { return; } _snapable = null; _snapableOffset = null; }
public void OnTriggerStay2D(Collider2D other) { if (_snapable != null) { return; } ISnapable snapable = other.GetComponent <ISnapable>(); if (snapable == null) { return; } if (_snapable != null && _snapable != snapable) { _snapable.UnHighlight(); } snapable.Highlight(); _snapable = snapable; }