0
点赞
收藏
分享

微信扫一扫

2024秋招算法

1kesou 2024-07-28 阅读 30

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 called before the first frame update
    public HitPoints hitPoints;
    public float maxHitPoints;
    //开始生命值
    public float startingHitPoints;
}

修改Player.cs

举报

相关推荐

0 条评论