using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 数值实例 - 常量
///
// [CreateAssetMenu(menuName = "MuHua/数值模块/数值实例")]
public class ValueInstanceConst : ScriptableObject {
/// 数值类型
public ValueType type;
/// 最小值
public float minValue;
/// 最大值
public float maxValue = 9999;
/// 基础值
public float baseValue;
/// 数值容器
[HideInInspector]
public ValueContainerConst container;
public void InitialFloat() {
Initial(ValueType.Float, 0, 9999, 0);
}
public void InitialInteger() {
Initial(ValueType.Integer, 0, 9999, 0);
}
public void InitialBoolean() {
Initial(ValueType.Boolean, 0, 1, 0);
}
public void InitialPercentage() {
Initial(ValueType.Percentage, 0, 100, 0);
}
public void Initial(ValueType type, float minValue, float maxValue, float baseValue) {
this.type = type;
this.minValue = minValue;
this.maxValue = maxValue;
this.baseValue = baseValue;
}
/// 转换数据
public ValueInstance To() {
var instance = ValueInstance.Create(type, name);
instance.Settings(baseValue, minValue, maxValue);
return instance;
}
}