I'm trying to build a dictionary that indexes each static method in a class so they can be looked up with a string. I can't seem to find a way to actually get a reference back to the method from the MethodInfo. Is this possible?
delegate void SkillEffect(BattleActor actor, BattleActor target);
public static class SkillEffectLookup
{
public static Dictionary<string, SkillEffect> lookup;
public static void Build()
{
lookup = new Dictionary<string, SkillEffect>();
Type type = typeof(SkillEffects);
var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
foreach (MethodInfo methodInfo in methods)
{
lookup.Add(methodInfo.Name, _____________);
}
}
public static class SkillEffects
{
public static Attack(BattleActor actor, BattleActor target)
{
// Do Things
}
public static NonAttack(BattleActor actor, BattleActor target)
{
// Do Other Things
}
}