using Manager; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Teleport : MonoBehaviour { public BossAI m; public bool isBattle; private void Awake() { if(isBattle) { m = GameObject.FindWithTag("Boss").GetComponentInChildren(); } } private void OnTriggerEnter2D(Collider2D collision) { if(isBattle) { if (m.GetIsDie() && collision.CompareTag("Player")) { Debug.Log("传送"); //保存玩家信息 CharacterCombat cm = collision.gameObject.GetComponentInChildren(); PlayerInfo.Instance.KeepData(cm.maxHp, cm.currentHp, cm.attack); UIManager.Instance.Show(); return; } } else { if (collision.CompareTag("Player")) { Debug.Log("传送"); //保存玩家信息 CharacterCombat cm = collision.gameObject.GetComponentInChildren(); PlayerInfo.Instance.KeepData(cm.maxHp,cm.currentHp,cm.attack); UIManager.Instance.Show(); return; } } } }