using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// HP记录员,用来在关卡间记录玩家剩余血量等信息 /// public class HPRecorder : MonoBehaviour { private MyPlayer player; public float HPLeft; void Start(){ if(FindObjectsOfType().Length > 1) Destroy(gameObject); DontDestroyOnLoad(gameObject); player = FindObjectOfType(); } void Update(){ HPLeft = player.HPLeft; } }