Remove methods for constructor in ReflectionHelper.

This commit is contained in:
2023-04-08 13:36:52 +08:00
parent 2221658e7a
commit 8907dd19b0
6 changed files with 9 additions and 25 deletions

View File

@@ -26,7 +26,7 @@ namespace Cryville.Crtr {
[Obsolete]
public static class MotionLerper {
public static void Lerp<T>(double time, double tt, T tv, double ft, T fv, TransitionType type, float rate, ref T result) where T : Vector {
if (fv == null) fv = (T)ReflectionHelper.InvokeEmptyConstructor(tv.GetType());
if (fv == null) fv = (T)Activator.CreateInstance(tv.GetType());
Lerp((float)((time - ft) / (tt - ft)), fv, tv, type, rate, ref result);
}
@@ -111,7 +111,7 @@ namespace Cryville.Crtr {
get { return m_GlobalInitValue.Clone(); }
}
public MotionRegistry(Type type) : this((Vector)ReflectionHelper.InvokeEmptyConstructor(type)) { }
public MotionRegistry(Type type) : this((Vector)Activator.CreateInstance(type)) { }
public MotionRegistry(Vector init) : this(init, init) { }
@@ -137,7 +137,7 @@ namespace Cryville.Crtr {
Value = init
}
};
AbsoluteValue = (Vector)ReflectionHelper.InvokeEmptyConstructor(init.GetType());
AbsoluteValue = (Vector)Activator.CreateInstance(init.GetType());
return this;
}
@@ -182,7 +182,7 @@ namespace Cryville.Crtr {
Id = node.Id,
Time = new Vec1(0),
Rate = new Vec1(1),
Value = (Vector)ReflectionHelper.InvokeEmptyConstructor(node.Value.GetType())
Value = (Vector)Activator.CreateInstance(node.Value.GetType())
};
}
else {