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 AddCanEnter(BoolMethod s) { if (s != null) { _canEnter.Add(s); } return(this); }
public State AddCanTransitionToSelf(BoolMethod s) { if (s != null) { _canTransitionToSelf.Add(s); } return(this); }
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); } }
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); }
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); }
public AnimationState AddIsPressed(BoolMethod s) { _isPressed.Add(s); return(this); }
public AnimationState AddCanEnter(BoolMethod s) { _canEnter.Add(s); return(this); }
public State SetCanEnter(BoolMethod s) { canEnter = s; return(this); }
public State SetReturnState(BoolMethod s) { returnState = s; return(this); }
public void StartFlashButton(Image buttonImage, BoolMethod boolMethod) { StartCoroutine(FlashButton(buttonImage, boolMethod)); }