110 lines
2.9 KiB
C#
110 lines
2.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "NewEquipment", menuName = "Equipment/Equipment SO")]
|
|
public class equipmentSO : ScriptableObject
|
|
{
|
|
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;
|
|
|
|
public float randomRangeStart = 0f;
|
|
public float randomRangeEnd = 0f;
|
|
|
|
[Min(0f)]
|
|
public float cultivationInterval = 0f;
|
|
|
|
public void Normalize()
|
|
{
|
|
basicGain = Mathf.Clamp(basicGain, -0.1f, 0.1f);
|
|
cultivationInterval = Mathf.Max(0f, cultivationInterval);
|
|
|
|
if (randomRangeEnd < randomRangeStart)
|
|
{
|
|
float cached = randomRangeStart;
|
|
randomRangeStart = randomRangeEnd;
|
|
randomRangeEnd = cached;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class EquipmentTierPresentation
|
|
{
|
|
public string tierName;
|
|
public Sprite tierIcon;
|
|
[TextArea(2, 6)] public string tierDescription;
|
|
}
|
|
|
|
[Serializable]
|
|
public class EquipmentSpecialEffect
|
|
{
|
|
public EquipmentSpecialEffectType effectType;
|
|
public float value;
|
|
public string displayName;
|
|
public Sprite displayIcon;
|
|
}
|
|
|
|
[Header("Basic Attributes")]
|
|
[Min(1)] public int level = 1;
|
|
public EquipmentTierPresentation[] tierPresentations = new EquipmentTierPresentation[5];
|
|
|
|
[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("Effect Rules")]
|
|
public bool onlyProduceSameTypeAttributes = false;
|
|
|
|
[Header("Special Effects")]
|
|
public EquipmentSpecialEffect[] specialEffects = Array.Empty<EquipmentSpecialEffect>();
|
|
|
|
[Header("幻化效果")]
|
|
public EquipmentSpecialEffect[] illusionEffects = Array.Empty<EquipmentSpecialEffect>();
|
|
|
|
private void OnValidate()
|
|
{
|
|
level = Mathf.Max(1, 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);
|
|
}
|
|
}
|
|
}
|