projectEli/Assets/NeoFPS/Core/MotionGraphs/Data/IntDataReference.cs

39 lines
829 B
C#
Raw Normal View History

2022-11-07 01:28:33 +00:00
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);
}
}
}