Files
zeling_v2/Assets/Scripts/World/PhantomInteractable.cs
2026-05-12 15:34:08 +08:00

20 lines
583 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
namespace BaseGames.World
{
/// <summary>
/// 幻影可交互机关。继承 DirectionalInteractable额外响应 PhantomBody 层(太虚斩形态)。
/// </summary>
public class PhantomInteractable : DirectionalInteractable
{
private void OnTriggerEnter2D(Collider2D other)
{
bool isPlayer = other.CompareTag("Player");
bool isPhantom = other.gameObject.layer == LayerMask.NameToLayer("PhantomBody");
if (!isPlayer && !isPhantom) return;
TryActivate();
}
}
}