using UnityEngine; namespace BaseGames.World { /// /// 幻影可交互机关。继承 DirectionalInteractable,额外响应 PhantomBody 层(太虚斩形态)。 /// public class PhantomInteractable : DirectionalInteractable { private int _phantomBodyLayer; private void Awake() => _phantomBodyLayer = LayerMask.NameToLayer("PhantomBody"); private void OnTriggerEnter2D(Collider2D other) { bool isPlayer = other.CompareTag("Player"); bool isPhantom = other.gameObject.layer == _phantomBodyLayer; if (!isPlayer && !isPhantom) return; TryActivate(); } } }