public void SetMethod(Object target, MethodInfo method) { ParameterInfo[] parameters = method.GetParameters(); switch (parameters.Length) { case 0: voidMethod = () => method.Invoke(target, new object[] { }); break; case 1: if (parameters[0].ParameterType == typeof(bool)) { boolMethod = (bool b) => method.Invoke(target, new object[] { b }); } else if (parameters[0].ParameterType == typeof(float)) { floatMethod = (float f) => method.Invoke(target, new object[] { f }); } else if (parameters[0].ParameterType == typeof(int)) { intMethod = (int x) => method.Invoke(target, new object[] { x }); } break; } }
public State SetUtility(FloatMethod s) { if (s != null) { _getUtility = s; } return(this); }
public void SetMethod(FloatMethod method, EventType _eventType = EventType.Always) { eventType = _eventType; floatMethod = method; methodParameterCount = 1; if (method != null) { SetMethodParameters(method.Target, method.Method); } }
/// <summary> /// Executes an action once per frame, method called has the time passed as parameter in % (Range 0f to 1f). /// </summary> /// <returns>Routine iterator.</returns> /// <param name="f">Duration in seconds.</param> /// <param name="a">Action callback, can NOT be null.</param> public static IEnumerator DoWhile(float f, FloatMethod a) { float t = 0f; while (t < f) { yield return(null); t += Time.deltaTime; a(t / f); } }
public AttentionMode SetUtility(FloatMethod utilityMethod) { this._utilityMethod = utilityMethod; return(this); }
public State SetUtility(float s) { _getUtility = () => s; return(this); }
public State SetUtility(FloatMethod s) { getUtility = s; return(this); }