projectEli/Assets/NeoFPS/Core/MotionGraphs/Data/IntDataReference.cs
2022-11-06 20:28:33 -05:00

39 lines
829 B
C#

using System;
using UnityEngine;
namespace NeoFPS.CharacterMotion.MotionData
{
[Serializable]
public struct IntDataReference
{
[SerializeField] private IntData m_Data;
[SerializeField] private int m_Value;
public int value
{
get
{
if (m_Data == null)
return m_Value;
else
return m_Data.value;
}
}
public IntDataReference(int v)
{
m_Data = null;
m_Value = v;
}
public void ClampValue(int min, int max)
{
m_Value = Mathf.Clamp(m_Value, min, max);
}
public void CheckReference(IMotionGraphMap map)
{
m_Data = map.Swap(m_Data);
}
}
}