private AnimatorEvent GetAnimatorEvent(Animator animator) { if (_animatorEvent == null) { _animatorEvent = animator.GetComponent <AnimatorEvent>(); } return(_animatorEvent); }
private AnimatorStateArgs StateArgs(int layerIndex, AnimatorStateInfo info, AnimatorEvent ev) { _stateArgs.animator = _animator; _stateArgs.@event = ev; _stateArgs.layerIndex = layerIndex; _stateArgs.info = info; return(_stateArgs); }
private AnimatorTransitionArgs TransitionArgs(int layerIndex, AnimatorEvent ev, AnimatorTransitionInfo info, AnimatorStateInfo prevState) { _transitionArgs.animator = _animator; _transitionArgs.@event = ev; _transitionArgs.layerIndex = layerIndex; _transitionArgs.prevState = prevState; _transitionArgs.info = info; return(_transitionArgs); }
int GetEventIndex(AnimatorEvent ae, string eventName) { for (int i = 0; i < ae.events.Length; i++) { if (ae.events[i].name == eventName) { return(i); } } return(-1); }
/// <summary> Add and AnimatorEvent, to the AnimatorEvents list, that will get invoked when this UIAction is invoked </summary> /// <param name="animatorEvent"> AnimatorEvent that gets invoked when this UIAction is invoked </param> public UIAction AddAnimatorEvent(AnimatorEvent animatorEvent) { if (animatorEvent == null) { return(this); } if (AnimatorEvents.Contains(animatorEvent)) { return(this); } AnimatorEvents.Add(animatorEvent); return(this); }
public bool HandleEvent(IGenericEvent evt) { if (evt is AnimatorEvent) { AnimatorEvent ae = evt as AnimatorEvent; int player = ae.pID; string action = ae.action; if (player == 1) { firstAnimator.SetTrigger(action); } if (player == 2) { secondAnimator.SetTrigger(action); } return(true); } return(false); }
public void SetAnimatorEvent(AnimatorEvent animatorEvent) { this.animatorEvent = animatorEvent; }