예제 #1
0
 private AnimatorEvent GetAnimatorEvent(Animator animator)
 {
     if (_animatorEvent == null)
     {
         _animatorEvent = animator.GetComponent <AnimatorEvent>();
     }
     return(_animatorEvent);
 }
예제 #2
0
 private AnimatorStateArgs StateArgs(int layerIndex, AnimatorStateInfo info, AnimatorEvent ev)
 {
     _stateArgs.animator   = _animator;
     _stateArgs.@event     = ev;
     _stateArgs.layerIndex = layerIndex;
     _stateArgs.info       = info;
     return(_stateArgs);
 }
예제 #3
0
 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);
 }
예제 #5
0
 /// <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);
 }
예제 #6
0
    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);
    }
예제 #7
0
 public void SetAnimatorEvent(AnimatorEvent animatorEvent)
 {
     this.animatorEvent = animatorEvent;
 }