装备系统做了很多
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
using System;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "NewEquipment", menuName = "Equipment/Equipment SO")]
|
||||
public class equipmentSO : ScriptableObject
|
||||
{
|
||||
public enum EquipmentSkillType
|
||||
{
|
||||
题海战术,
|
||||
诛锄异己,
|
||||
逸乐共谋,
|
||||
完美至上,
|
||||
涵养心境,
|
||||
众志成城,
|
||||
过激行为,
|
||||
二次形变
|
||||
}
|
||||
|
||||
public enum EquipmentSpecialEffectType
|
||||
{
|
||||
MaxHp,
|
||||
@@ -23,9 +35,6 @@ public class equipmentSO : ScriptableObject
|
||||
[Range(-0.1f, 0.1f)]
|
||||
public float basicGain = 0f;
|
||||
|
||||
public float randomRangeStart = 0f;
|
||||
public float randomRangeEnd = 0f;
|
||||
|
||||
[Min(0f)]
|
||||
public float cultivationInterval = 0f;
|
||||
|
||||
@@ -33,13 +42,6 @@ public class equipmentSO : ScriptableObject
|
||||
{
|
||||
basicGain = Mathf.Clamp(basicGain, -0.1f, 0.1f);
|
||||
cultivationInterval = Mathf.Max(0f, cultivationInterval);
|
||||
|
||||
if (randomRangeEnd < randomRangeStart)
|
||||
{
|
||||
float cached = randomRangeStart;
|
||||
randomRangeStart = randomRangeEnd;
|
||||
randomRangeEnd = cached;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ public class equipmentSO : ScriptableObject
|
||||
public class EquipmentTierPresentation
|
||||
{
|
||||
public string tierName;
|
||||
public Sprite tierIcon;
|
||||
public Sprite equipmentSprite;
|
||||
[TextArea(2, 6)] public string tierDescription;
|
||||
}
|
||||
|
||||
@@ -56,13 +58,14 @@ public class equipmentSO : ScriptableObject
|
||||
{
|
||||
public EquipmentSpecialEffectType effectType;
|
||||
public float value;
|
||||
public string displayName;
|
||||
public Sprite displayIcon;
|
||||
}
|
||||
|
||||
[Header("技能类型")]
|
||||
public EquipmentSkillType skillType;
|
||||
|
||||
[Header("Basic Attributes")]
|
||||
[Min(1)] public int level = 1;
|
||||
public EquipmentTierPresentation[] tierPresentations = new EquipmentTierPresentation[5];
|
||||
[Min(0)] public int level = 0;
|
||||
public equipmentTierNameConfigSO tierNameConfig;
|
||||
|
||||
[Header("Max HP")]
|
||||
public EquipmentStatTuning maxHp = new EquipmentStatTuning();
|
||||
@@ -79,31 +82,94 @@ public class equipmentSO : ScriptableObject
|
||||
[Header("Score Efficiency")]
|
||||
public EquipmentStatTuning scoreEfficiency = new EquipmentStatTuning();
|
||||
|
||||
[Header("Effect Rules")]
|
||||
public bool onlyProduceSameTypeAttributes = false;
|
||||
|
||||
[Header("Special Effects")]
|
||||
public EquipmentSpecialEffect[] specialEffects = Array.Empty<EquipmentSpecialEffect>();
|
||||
|
||||
[Header("是否共鸣")]
|
||||
public bool enableTypeSameEffects = false;
|
||||
|
||||
[Header("共鸣特效")]
|
||||
public EquipmentSpecialEffect[] typeSameEffects = Array.Empty<EquipmentSpecialEffect>();
|
||||
|
||||
[Header("幻化效果")]
|
||||
public EquipmentSpecialEffect[] illusionEffects = Array.Empty<EquipmentSpecialEffect>();
|
||||
|
||||
[Header("满级效果")]
|
||||
public EquipmentSpecialEffect[] maxLevelEffects = Array.Empty<EquipmentSpecialEffect>();
|
||||
|
||||
[Header("携带技能id")]
|
||||
public int sa_skillID;
|
||||
public int ia_skillID;
|
||||
|
||||
public int GetTierStageIndex()
|
||||
{
|
||||
if (level >= 20)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (level >= 15)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (level >= 10)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (level >= 5)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public EquipmentTierPresentation GetCurrentTierPresentation()
|
||||
{
|
||||
return GetTierPresentationByStageIndex(GetTierStageIndex());
|
||||
}
|
||||
|
||||
public EquipmentTierPresentation GetTierPresentationByStageIndex(int stageIndex)
|
||||
{
|
||||
if (tierNameConfig == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (tierNameConfig.TryGetStagePresentation(skillType, stageIndex, out equipmentTierNameConfigSO.StagePresentation configured))
|
||||
{
|
||||
return new EquipmentTierPresentation
|
||||
{
|
||||
tierName = configured.tierName,
|
||||
equipmentSprite = configured.equipmentSprite,
|
||||
tierDescription = configured.tierDescription
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetCurrentTierDisplayName()
|
||||
{
|
||||
EquipmentTierPresentation current = GetCurrentTierPresentation();
|
||||
return current != null ? current.tierName : string.Empty;
|
||||
}
|
||||
|
||||
public Sprite GetCurrentEquipmentSprite()
|
||||
{
|
||||
EquipmentTierPresentation current = GetCurrentTierPresentation();
|
||||
return current != null ? current.equipmentSprite : null;
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
level = Mathf.Max(1, level);
|
||||
level = Mathf.Max(0, level);
|
||||
maxHp?.Normalize();
|
||||
attack?.Normalize();
|
||||
maxMana?.Normalize();
|
||||
damageResistance?.Normalize();
|
||||
scoreEfficiency?.Normalize();
|
||||
|
||||
if (tierPresentations == null)
|
||||
{
|
||||
tierPresentations = new EquipmentTierPresentation[5];
|
||||
}
|
||||
else if (tierPresentations.Length != 5)
|
||||
{
|
||||
Array.Resize(ref tierPresentations, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user