修复BUG

This commit is contained in:
MuHua-123
2025-10-09 15:04:34 +08:00
parent 1b017de1ba
commit bd27595b0d
23 changed files with 29 additions and 108 deletions
@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Accessory : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7cfcaecd119af2f48adf5a4649d88360
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Armor : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: de8ae08be418e3c48a7f938b6b842caa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,13 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 装备
/// </summary>
public class Equipment : InventoryItem {
/// <summary> 装备类型 (类型1/类型2 </summary>
public string type;
/// <summary> 词缀列表 </summary>
public List<EquipmentAffix> affixes = new List<EquipmentAffix>();
}
@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4fdef6696992dc94f977f5ca3a2cc528
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fa01c7c9647ebd6468b17280d5065639
guid: 0d2605ccaa6985d4e9296b749694fc1d
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 装备
/// </summary>
public class Equipment : InventoryItem {
/// <summary>
/// 装备类型:稀有度/装备类型/次级类型/种类
/// <br/>稀有度:普通,精良,稀有,史诗,传奇,神话
/// <br/>装备类型:武器,护甲,饰品
/// <br/>次级类型:单手,副手,双手,上衣,头盔,手套,腰带,鞋子,项链,戒指,手镯
/// <br/>装备种类:剑,锤,枪,弓,斧头,盾牌,法杖,魔杖
/// </summary>
public string type;
/// <summary> 词缀列表 </summary>
public List<EquipmentAffix> affixes = new List<EquipmentAffix>();
}
@@ -16,14 +16,16 @@ public class ValueInstance {
/// <summary> 最大值 </summary>
public float maxValue;
/// <summary> 最终数值 </summary>
public float value;
/// <summary> 默认值 </summary>
public float defaultValue;
/// <summary> 基础值 </summary>
public float baseValue;
/// <summary> 附加值% </summary>
public float addedValue;
/// <summary> 当前值 </summary>
public float currentValue;
/// <summary> 最终数值 </summary>
public float value;
/// <summary> 修改器列表 </summary>
public List<ValueModifier> modifiers = new List<ValueModifier>();
@@ -53,15 +55,15 @@ public class ValueInstance {
/// <summary> 重新计算值 </summary>
public void RecalculateValue() {
addedValue = 1;
currentValue = baseValue;
baseValue = defaultValue;
modifiers.ForEach(Modify);
}
/// <summary> 修改 </summary>
public void Modify(ValueModifier modifier) {
baseValue += modifier.FixedValue;
addedValue += modifier.AddedValue;
currentValue += modifier.FixedValue;
value = currentValue * addedValue;
value = Mathf.Clamp(currentValue, minValue, maxValue);
float temp = baseValue * addedValue;
value = Mathf.Clamp(temp, minValue, maxValue);
}
}
@@ -52,7 +52,7 @@ public class ValueInstanceConst : ScriptableObject {
ValueInstance instance = new ValueInstance(type, name);
instance.minValue = minValue;
instance.maxValue = maxValue;
instance.baseValue = baseValue;
instance.defaultValue = baseValue;
instance.RecalculateValue();
return instance;
}