init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Sirenix.OdinInspector;
|
||||
using VOID.Generic.Dict;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Data
|
||||
{
|
||||
[Serializable]
|
||||
public record SubAttributes
|
||||
{
|
||||
[MinValue(1f)] public int damageMin = 1;
|
||||
[MinValue(1f)] public int damageMax = 1;
|
||||
[MinValue(0f)] public float criticalDamageChance = 0f;
|
||||
[MinValue(0f)] public float criticalDamageMultiplier = 2f;
|
||||
public float accuracy = 0.6f;
|
||||
public float dodge = 0.05f;
|
||||
[MinValue(0f)] public float carryCapacity = 50f;
|
||||
[MinValue(0f)] public float sight = 0f;
|
||||
[MinValue(0f)] public float hear = 0f;
|
||||
[MinValue(0f)] public float move = 0f;
|
||||
public float initiative = 0f;
|
||||
|
||||
public float Get(SubAttributeType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
SubAttributeType.DamageMin => damageMin,
|
||||
SubAttributeType.DamageMax => damageMax,
|
||||
SubAttributeType.CriticalDamageChance => criticalDamageChance,
|
||||
SubAttributeType.CriticalDamageMultiplier => criticalDamageMultiplier,
|
||||
SubAttributeType.Accuracy => accuracy,
|
||||
SubAttributeType.Dodge => dodge,
|
||||
SubAttributeType.CarryCapacity => carryCapacity,
|
||||
SubAttributeType.Sight => sight,
|
||||
SubAttributeType.Hear => hear,
|
||||
SubAttributeType.Move => move,
|
||||
SubAttributeType.Initiative => initiative,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
||||
};
|
||||
}
|
||||
|
||||
public void Set(SubAttributeType type, float value)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SubAttributeType.DamageMin: damageMin = (int)value; return;
|
||||
case SubAttributeType.DamageMax: damageMax = (int)value; return;
|
||||
case SubAttributeType.CriticalDamageChance: criticalDamageChance = value; return;
|
||||
case SubAttributeType.CriticalDamageMultiplier: criticalDamageMultiplier = value; return;
|
||||
case SubAttributeType.Accuracy: accuracy = value; return;
|
||||
case SubAttributeType.Dodge: dodge = value; return;
|
||||
case SubAttributeType.CarryCapacity: carryCapacity = value; return;
|
||||
case SubAttributeType.Sight: sight = value; return;
|
||||
case SubAttributeType.Hear: hear = value; return;
|
||||
case SubAttributeType.Move: move = value; return;
|
||||
case SubAttributeType.Initiative: initiative = value; return;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user