using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static EventSystem.Framework.Delegates; namespace EventSystem.Framework { /// /// Used to pair a function and a parameter list using the super object class to run virtually any function for map events. /// public class functionEvent { public paramFunction function; public List parameters; /// /// Constructor. /// /// The function to be called when running an event. /// The list of system.objects to be used in the function. Can include objects,strings, ints, etc. Anything can be passed in as a parameter or can be passed in as empty. Passing in null will just create an empty list. public functionEvent(paramFunction Function, List Parameters) { if (this.parameters == null) this.parameters = new List(); this.function = Function; this.parameters = Parameters; } /// /// Runs the function with the passed in parameters. /// public void run() { this.function.Invoke(this.parameters); } /// /// Simply swaps out the old parameters list for a new one. /// /// public void updateParameters(List newParameters) { this.parameters = newParameters; } } }