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

39 lines
837 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 FloatDataReference
{
[SerializeField] private FloatData m_Data;
[SerializeField] private float m_Value;
public float value
{
get
{
if (m_Data == null)
return m_Value;
else
return m_Data.value;
}
}
public FloatDataReference(float v)
{
m_Data = null;
m_Value = v;
}
public void ClampValue(float min, float max)
{
m_Value = Mathf.Clamp(m_Value, min, max);
}
public void CheckReference(IMotionGraphMap map)
{
m_Data = map.Swap(m_Data);
}
}
}