public void OnTriggerExit2D(Collider2D other) { IAbilitySource abilitySource = other.GetComponent <IAbilitySource>(); if (abilitySource == null) { return; } _abilitySource?.UnHighlight(); if (_abilitySource != abilitySource) { return; } _abilitySource = null; }
public void OnTriggerStay2D(Collider2D other) { if (_abilitySource != null) { return; } IAbilitySource abilitySource = other.GetComponent <IAbilitySource>(); if (abilitySource == null) { return; } if (_abilitySource != null && _abilitySource != abilitySource) { _abilitySource.UnHighlight(); } abilitySource.Highlight(); _abilitySource = abilitySource; }