Invoking methods cross-class with arguments

Edit: Through alot of confusion and miscommunications, I think it is better to rewrite the question entirely! Essentially I want to store predefined variables for a methods arguments inside an unrelated (not same namespace etc.) class, and call said method with said arguments from said unrelated class.

The idea: In many RTS games, like Star Craft, you can stack unit orders. I want to do this aswell. The problem isn’t stacking AI actions, but rather storing their arguments.

Here is a quick example:
You click somewhere, the AI walks there. In my AI this is a method called GoToThisLocation.
You shift-click somewhere and the AI will walk to all of the clicked points, in order. This is what I want to do better. Right now it stores a list of Vector3s and an index int and all that in the main AI script.

I already have a script which keeps track of the AIs stacked behaviours, so I thought it would be a neat idea to store the list of Vector3s inside this script, which works dynamically. What I mean is this script is supposed to work for everything, so hardcoding in a list of specifically Vector3s wouldn’t be ideal.

Problem number one is to store any type of argument in the standalone dynamic script, so it would still work for any type of script.

This script also calls the methods of the main AI script automatically, so I also need to know how to invoke a method cross-classes with arguments.

Edit: It works flawlessy! Thanks alot guys!

If I got you correctly, you are looking for calling any method with any type of params by using Invoke. Here is a helper method which take multiple objects and its types and call the required method.

private static void InvokeMethod (object _object, Type _objectType, string _method, object[] _argValueList, Type[] _argTypeList)
{
	BindingFlags 	_bindingAttr	= BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.OptionalParamBinding;
	MethodInfo 		_methodInfo		= null;

	// Find method info based on method name, parameter
	if (_argValueList != null)
		_methodInfo 				= _objectType.GetMethod(_method, _bindingAttr, null, _argTypeList, null);
	else
		_methodInfo					= _objectType.GetMethod(_method, _bindingAttr);

	// Invoke the method
	if (_methodInfo != null)
	{
		_methodInfo.Invoke(_object, _argValueList);
	}
	// Failed to find a matching method, so search for it in base class
	else if (_objectType.BaseType != null)
	{
		InvokeMethod(_object, _objectType.BaseType, _method, _argValueList, _argTypeList);
	}
	// Object doesnt have this method
	else
	{
		throw new MissingMethodException();
	}
}

*Credits : Ashwin done for CPNP