HitPoints
在ScriptableObjects文件夹中创建新的脚本,叫HitPoint
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//创建条目,方便轻松创建HitPoints的实例
[CreateAssetMenu(menuName ="HitPoints")]
public class HitPoints : ScriptableObject
{
//使用float保存生命值,在生命条的Meter中,Fill Amount 属性float
public float value;
}
更新Character.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class Character : MonoBehaviour
{
// Start is calle