31 lines
817 B
C#
31 lines
817 B
C#
using System;
|
|
using Sirenix.OdinInspector;
|
|
using VOID.Generic.Dict;
|
|
|
|
namespace VOID.Generic.Objects.Abstract.Data
|
|
{
|
|
[Serializable]
|
|
public record Resources
|
|
{
|
|
[MinValue(0f)]
|
|
public float health = 10f;
|
|
|
|
public float Get(BasicResourceType type)
|
|
{
|
|
return type switch
|
|
{
|
|
BasicResourceType.Health => health,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
|
};
|
|
}
|
|
|
|
public void Set(BasicResourceType type, float value)
|
|
{
|
|
switch(type)
|
|
{
|
|
case BasicResourceType.Health: health = value; return;
|
|
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
|
};
|
|
}
|
|
}
|
|
} |