예제 #1
0
 public void Stop(AnimState _s, bool _checkWeight = false)
 {
     if (_s.curAnimName != null)
     {
         if (_checkWeight && _s.anim[_s.curAnimName].weight == 0.0f)
         {
             _s.anim.Stop(_s.curAnimName);
         }
         else
         {
             _s.anim.Stop(_s.curAnimName);
         }
     }
 }
예제 #2
0
        public NullBlendToStopAnimState(string _name, Animation _anim, State _parent = null)
            : base(_name, _anim, _parent)
        {
            AnimState from = null;

            onEnter += delegate(State _from, State _to) {
                from = _from as AnimState;
            };
            onAction += delegate(State _cur) {
                if (from != null)
                {
                    Stop(from, true); // stop when weight is zero;
                }
            };
            onExit += delegate(State _from, State _to) {
                // in case we are doing state transition, but the animation still not blend to zero
                if (from != null)
                {
                    Stop(from); // stop any way
                }
            };
        }
예제 #3
0
 /// <summary> 声明状态的跳转 </summary>
 /// <param name="_targetState"> 目标状态 </param>
 /// <param name="_duration"> 动画过渡所需时间 </param>
 public AnimTransition to(AnimState _targetState, float _duration = 0.3f, bool _syncNTime = false)
 {
     AnimTransition transition = new AnimTransition() {
     source = this,
     target = _targetState,
     duration = _duration,
     syncNormalizedTime = _syncNTime,
     };
     transitionList.Add (transition);
     return transition;
 }
예제 #4
0
 public void Stop( AnimState _s, bool _checkWeight = false )
 {
     if ( _s.curAnimName != null ) {
     if ( _checkWeight && _s.anim[_s.curAnimName].weight == 0.0f ) {
         _s.anim.Stop(_s.curAnimName);
     }
     else {
         _s.anim.Stop(_s.curAnimName);
     }
     }
 }
예제 #5
0
 public void Blend( AnimState _s, float _to, Transition _transition)
 {
     if ( _s.curAnimName != null ) {
     _s.anim.Blend(_s.curAnimName, _to, ((TimerTransition)_transition).duration);
     }
 }