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