修复BUG
This commit is contained in:
@@ -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
-1
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: fa01c7c9647ebd6468b17280d5065639
|
guid: 0d2605ccaa6985d4e9296b749694fc1d
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
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>
|
/// <summary> 最大值 </summary>
|
||||||
public float maxValue;
|
public float maxValue;
|
||||||
|
|
||||||
|
/// <summary> 最终数值 </summary>
|
||||||
|
public float value;
|
||||||
|
/// <summary> 默认值 </summary>
|
||||||
|
public float defaultValue;
|
||||||
/// <summary> 基础值 </summary>
|
/// <summary> 基础值 </summary>
|
||||||
public float baseValue;
|
public float baseValue;
|
||||||
/// <summary> 附加值% </summary>
|
/// <summary> 附加值% </summary>
|
||||||
public float addedValue;
|
public float addedValue;
|
||||||
/// <summary> 当前值 </summary>
|
/// <summary> 当前值 </summary>
|
||||||
public float currentValue;
|
public float currentValue;
|
||||||
/// <summary> 最终数值 </summary>
|
|
||||||
public float value;
|
|
||||||
|
|
||||||
/// <summary> 修改器列表 </summary>
|
/// <summary> 修改器列表 </summary>
|
||||||
public List<ValueModifier> modifiers = new List<ValueModifier>();
|
public List<ValueModifier> modifiers = new List<ValueModifier>();
|
||||||
@@ -53,15 +55,15 @@ public class ValueInstance {
|
|||||||
/// <summary> 重新计算值 </summary>
|
/// <summary> 重新计算值 </summary>
|
||||||
public void RecalculateValue() {
|
public void RecalculateValue() {
|
||||||
addedValue = 1;
|
addedValue = 1;
|
||||||
currentValue = baseValue;
|
baseValue = defaultValue;
|
||||||
modifiers.ForEach(Modify);
|
modifiers.ForEach(Modify);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 修改 </summary>
|
/// <summary> 修改 </summary>
|
||||||
public void Modify(ValueModifier modifier) {
|
public void Modify(ValueModifier modifier) {
|
||||||
|
baseValue += modifier.FixedValue;
|
||||||
addedValue += modifier.AddedValue;
|
addedValue += modifier.AddedValue;
|
||||||
currentValue += modifier.FixedValue;
|
float temp = baseValue * addedValue;
|
||||||
value = currentValue * addedValue;
|
value = Mathf.Clamp(temp, minValue, maxValue);
|
||||||
value = Mathf.Clamp(currentValue, minValue, maxValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ValueInstanceConst : ScriptableObject {
|
|||||||
ValueInstance instance = new ValueInstance(type, name);
|
ValueInstance instance = new ValueInstance(type, name);
|
||||||
instance.minValue = minValue;
|
instance.minValue = minValue;
|
||||||
instance.maxValue = maxValue;
|
instance.maxValue = maxValue;
|
||||||
instance.baseValue = baseValue;
|
instance.defaultValue = baseValue;
|
||||||
instance.RecalculateValue();
|
instance.RecalculateValue();
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user