private void DoCache() { m_LerpCache = DTypeInfo <TTar> .Lerp; m_ZeroCache = DTypeInfo <TTar> .Zero; m_AddCache = DTypeInfo <TTar> .Add; m_CacheDone = true; }
private void DoCache() { if (m_ZeroCache == null) { m_ZeroCache = DTypeInfo <TTar> .Zero; } if (m_LerpCache == null) { m_LerpCache = DTypeInfo <TTar> .Lerp; } }
/// <summary> /// Teach ioDriver how to Lerp type T. /// </summary> /// <typeparam name="T">Object Type</typeparam> /// <param name="_lerpFunc">Function containing LERP opertion for type T</param> public static void TeachLerp <T>(Teacher.FuncLerp <T> _lerpFunc) { DTypeInfo <T> .Lerp = _lerpFunc; if (m_TaughtTypes == null) { ioDriver.Init(); } if (!m_TaughtTypes.ContainsKey(typeof(T))) { m_TaughtTypes.Add(typeof(T), new HashSet <TeachType>()); } m_TaughtTypes[typeof(T)].Add(TeachType.Lerp); }
/// <summary> /// Teach ioDriver how to use type T. /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="_zero">Zero equivalent of Type T</param> /// <param name="_add">Addition function for type T</param> /// <param name="_length">Length function for type T</param> /// <param name="_lerp">LERP function for type T</param> /// <param name="_iLerp">ILERP function for type T</param> public static void Teach <T>(T _zero, Teacher.FuncAdd <T> _add, Teacher.FuncLength <T> _length, Teacher.FuncLerp <T> _lerp, Teacher.FuncILerp <T> _iLerp) { DTypeInfo <T> .ZeroFunc = () => _zero; DTypeInfo <T> .Zero = _zero; DTypeInfo <T> .Add = _add; DTypeInfo <T> .Length = _length; DTypeInfo <T> .Lerp = _lerp; DTypeInfo <T> .ILerp = _iLerp; if (m_TaughtTypes == null) { ioDriver.Init(); } if (!m_TaughtTypes.ContainsKey(typeof(T))) { m_TaughtTypes.Add(typeof(T), new HashSet <TeachType>()); } m_TaughtTypes[typeof(T)].Add(TeachType.Zero); m_TaughtTypes[typeof(T)].Add(TeachType.Add); m_TaughtTypes[typeof(T)].Add(TeachType.Length); m_TaughtTypes[typeof(T)].Add(TeachType.Lerp); m_TaughtTypes[typeof(T)].Add(TeachType.ILerp); }
private void DoCache() { m_LerpCache = DTypeInfo <TTar> .Lerp; m_LengthCache = DTypeInfo <TTar> .Length; m_CacheDone = true; }
private static void DoCache() { m_LerpCache = DTypeInfo <TTar> .Lerp; m_CacheDone = true; }