176 lines
4.3 KiB
C#
176 lines
4.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "NewEquipment", menuName = "Equipment/Equipment SO")]
|
|
public class equipmentSO : ScriptableObject
|
|
{
|
|
public enum EquipmentSkillType
|
|
{
|
|
题海战术,
|
|
诛锄异己,
|
|
逸乐共谋,
|
|
完美至上,
|
|
涵养心境,
|
|
众志成城,
|
|
过激行为,
|
|
二次形变
|
|
}
|
|
|
|
public enum EquipmentSpecialEffectType
|
|
{
|
|
MaxHp,
|
|
Attack,
|
|
MaxMana,
|
|
DamageResistance,
|
|
ScoreEfficiency,
|
|
HitManaRecovery,
|
|
HitDamageMultiplier,
|
|
HpLoseBase,
|
|
Skill
|
|
}
|
|
|
|
[Serializable]
|
|
public class EquipmentStatTuning
|
|
{
|
|
[Range(-0.1f, 0.1f)]
|
|
public float basicGain = 0f;
|
|
|
|
[Min(0f)]
|
|
public float cultivationInterval = 0f;
|
|
|
|
public void Normalize()
|
|
{
|
|
basicGain = Mathf.Clamp(basicGain, -0.1f, 0.1f);
|
|
cultivationInterval = Mathf.Max(0f, cultivationInterval);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class EquipmentTierPresentation
|
|
{
|
|
public string tierName;
|
|
public Sprite equipmentSprite;
|
|
[TextArea(2, 6)] public string tierDescription;
|
|
}
|
|
|
|
[Serializable]
|
|
public class EquipmentSpecialEffect
|
|
{
|
|
public EquipmentSpecialEffectType effectType;
|
|
public float value;
|
|
}
|
|
|
|
[Header("技能类型")]
|
|
public EquipmentSkillType skillType;
|
|
|
|
[Header("Basic Attributes")]
|
|
[Min(0)] public int level = 0;
|
|
public equipmentTierNameConfigSO tierNameConfig;
|
|
|
|
[Header("Max HP")]
|
|
public EquipmentStatTuning maxHp = new EquipmentStatTuning();
|
|
|
|
[Header("Attack")]
|
|
public EquipmentStatTuning attack = new EquipmentStatTuning();
|
|
|
|
[Header("Max Mana")]
|
|
public EquipmentStatTuning maxMana = new EquipmentStatTuning();
|
|
|
|
[Header("Damage Resistance")]
|
|
public EquipmentStatTuning damageResistance = new EquipmentStatTuning();
|
|
|
|
[Header("Score Efficiency")]
|
|
public EquipmentStatTuning scoreEfficiency = new EquipmentStatTuning();
|
|
|
|
[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(0, level);
|
|
maxHp?.Normalize();
|
|
attack?.Normalize();
|
|
maxMana?.Normalize();
|
|
damageResistance?.Normalize();
|
|
scoreEfficiency?.Normalize();
|
|
}
|
|
}
|