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;
            }
        }
Beispiel #2
0
 public State AddCanEnter(BoolMethod s)
 {
     if (s != null)
     {
         _canEnter.Add(s);
     }
     return(this);
 }
Beispiel #3
0
 public State AddCanTransitionToSelf(BoolMethod s)
 {
     if (s != null)
     {
         _canTransitionToSelf.Add(s);
     }
     return(this);
 }
Beispiel #4
0
 public State AddShallReturn(BoolMethod s)
 {
     if (s != null)
     {
         _shallReturn.Add(s);
     }
     return(this);
 }
 public void SetMethod(BoolMethod method, EventType _eventType = EventType.Change)
 {
     eventType            = _eventType;
     boolMethod           = method;
     methodParameterCount = 1;
     if (method != null)
     {
         SetMethodParameters(method.Target, method.Method);
     }
 }
Beispiel #6
0
 private IEnumerator FlashButton(Image buttonImage, BoolMethod boolMethod)
 {
     for (float time = 0; boolMethod(); time += Time.deltaTime * 5)
     {
         float transparency = (Mathf.Cos(time) + 2f) / 3f;
         buttonImage.color = new Color(buttonImage.color.r, buttonImage.color.g, buttonImage.color.b, transparency);
         yield return(null);
     }
     buttonImage.color = new Color(buttonImage.color.r, buttonImage.color.g, buttonImage.color.b, 1f);
 }
Beispiel #7
0
        public AnimationState AddTransition(AnimationState target, RangedFloat transitionRange, AnimationBlendData transitionData, bool bufferInput = true, BoolMethod canEnter = null)
        {
            AnimationTransition transition = new AnimationTransition();

            transition.target          = target;
            transition.transitionRange = transitionRange;
            transition.blendData       = transitionData;
            transition.bufferInput     = bufferInput;
            if (canEnter != null)
            {
                transition.canEnter = canEnter;
            }

            _transitions.Add(transition);
            return(this);
        }
Beispiel #8
0
 public AnimationState AddIsPressed(BoolMethod s)
 {
     _isPressed.Add(s);
     return(this);
 }
Beispiel #9
0
 public AnimationState AddCanEnter(BoolMethod s)
 {
     _canEnter.Add(s);
     return(this);
 }
Beispiel #10
0
 public State SetCanEnter(BoolMethod s)
 {
     canEnter = s;
     return(this);
 }
Beispiel #11
0
 public State SetReturnState(BoolMethod s)
 {
     returnState = s;
     return(this);
 }
Beispiel #12
0
 public void StartFlashButton(Image buttonImage, BoolMethod boolMethod)
 {
     StartCoroutine(FlashButton(buttonImage, boolMethod));
 }