using UnityEngine;
using GameFramework;
using IndianOceanAssets.Engine2_5D;
///
/// 传送门/出口 Door —— 玩家碰触后触发胜利流程。
/// 挂载在 Door 预制体根对象上,Collider 设为 Trigger。
///
public class DoorPortal : MonoBehaviour
{
void Awake()
{
var col = GetComponent();
if (col != null) col.isTrigger = true;
}
void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player")) return;
// 玩家进入传送门后永久无敌,胜利流程中不再掉血
var health = other.GetComponent();
if (health != null)
{
health.MakeInvincible(); // duration<=0 即永久无敌
Debug.Log("[DoorPortal] 玩家已进入无敌状态");
}
Debug.Log("[DoorPortal] 玩家进入传送门,触发胜利!");
GameManager.Win();
}
}