GameDev.CoreSystems/Architecture/ScriptableObjects/Variables/UShortVariable.cs

32 lines
939 B
C#

using UnityEngine;
using UnityEngine.Events;
namespace ScriptableObjectArchitecture
{
[System.Serializable]
public class UShortEvent : UnityEvent<ushort> { }
[CreateAssetMenu(
fileName = "UnsignedShortVariable.asset",
menuName = SOArchitecture_Utility.ADVANCED_VARIABLE_SUBMENU + "ushort",
order = SOArchitecture_Utility.ASSET_MENU_ORDER_COLLECTIONS + 18)]
public class UShortVariable : BaseVariable<ushort, UShortEvent>
{
public override bool Clampable { get { return true; } }
protected override ushort ClampValue(ushort value)
{
if (value.CompareTo(MinClampValue) < 0)
{
return MinClampValue;
}
else if (value.CompareTo(MaxClampValue) > 0)
{
return MaxClampValue;
}
else
{
return value;
}
}
}
}