public static int GetUniqueIdForType(this IReplicatedBehaviour repl_behaviour) { int hashCode; if (!IReplicatedBehaviourExtension.s_ReplBehaviourUniqueIds.TryGetValue(repl_behaviour.GetType(), out hashCode)) { hashCode = repl_behaviour.GetType().FullName.GetHashCode(); IReplicatedBehaviourExtension.s_ReplBehaviourUniqueIds[repl_behaviour.GetType()] = hashCode; } return(hashCode); }
public static TDelegate GetReflectedMethod <TDelegate>(this IReplicatedBehaviour obj, ReplicationComponentReflection.ReflectedMethodType method_type) where TDelegate : class { MethodInfo methodInfo = ReplicationComponentReflection.GetMethodInfo(obj.GetType(), method_type); if (methodInfo != null) { return(Delegate.CreateDelegate(typeof(TDelegate), obj, methodInfo) as TDelegate); } return(default(TDelegate)); }