Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public State SetUtility(FloatMethod s)
 {
     if (s != null)
     {
         _getUtility = s;
     }
     return(this);
 }
Exemplo n.º 3
0
 public void SetMethod(FloatMethod method, EventType _eventType = EventType.Always)
 {
     eventType            = _eventType;
     floatMethod          = method;
     methodParameterCount = 1;
     if (method != null)
     {
         SetMethodParameters(method.Target, method.Method);
     }
 }
Exemplo n.º 4
0
    /// <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);
        }
    }
Exemplo n.º 5
0
 public AttentionMode SetUtility(FloatMethod utilityMethod)
 {
     this._utilityMethod = utilityMethod;
     return(this);
 }
Exemplo n.º 6
0
 public State SetUtility(float s)
 {
     _getUtility = () => s;
     return(this);
 }
Exemplo n.º 7
0
 public State SetUtility(FloatMethod s)
 {
     getUtility = s;
     return(this);
 }