用反射代替switch语句,解决需求变更问题
Type t = receiver.GetType();
//反射
MethodInfo methodInfo = t.GetMethod("CreateCharacter");
//将特定类型分配给泛型方法定义的类型参数
methodInfo = methodInfo.MakeGenericMethod(soldierType);
//参数数组
object[] parameters = new object[] { weaponType, pos, lv };
methodInfo.Invoke(receiver, parameters);