void ActionHandler.Effect <T>(object action, GameAI <T> client) { switch (action) { case string noArg: if (noArg == INITIAL_STATE) { return; } Print($"No-arg: {noArg} @{frameCount}"); Map(noArg, client).Invoke(client, NoArg); return; case System.Action method: Print($"Delegate: {method.Method.Name} @{frameCount}"); method(); return; case null: client.Idle(); return; default: throw new ArgumentException(UNKNOWN_ARG + action); } }
MethodInfo Map <T>(string name, GameAI <T> client) where T : class { map = map ?? new Dictionary <string, MethodInfo>(); MethodInfo method; map.TryGetValue(name, out method); if (method == null) { map[name] = method = client.GetType().GetMethod(name); } return(method); }