init
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user