using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 属性实例 - 常量 /// [CreateAssetMenu(menuName = "MuHua/属性模块/属性实例")] public class AttributeInstanceConst : ScriptableObject { /// 属性类型 public AttributeType type; /// 默认值 public float defaultValue; /// 最小值 public float minValue; /// 最大值 public float maxValue = 9999; /// 属性容器 [HideInInspector] public AttributeContainerConst container; public void InitialFloat() { type = AttributeType.Float; defaultValue = 0; minValue = 0; maxValue = 9999; } public void InitialInteger() { type = AttributeType.Integer; defaultValue = 0; minValue = 0; maxValue = 9999; } public void InitialBoolean() { type = AttributeType.Boolean; defaultValue = 0; minValue = 0; maxValue = 1; } public void InitialPercentage() { type = AttributeType.Percentage; defaultValue = 0; minValue = 0; maxValue = 100; } /// 转换数据 public AttributeInstance To() { AttributeInstance instance = new AttributeInstance(); instance.type = type; instance.name = name; instance.baseValue = defaultValue; instance.currentValue = defaultValue; instance.minValue = minValue; instance.maxValue = maxValue; return instance; } }