// Activate a Mecanim animation
			private void Activate(Animator animator) {
				if (animationState == empty) return;
				
				if (resetNormalizedTime) animator.CrossFade(animationState, crossfadeTime, layer, 0f);
				else animator.CrossFade(animationState, crossfadeTime, layer);
			}
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator!=null)
			{
				int _layer = layer.IsNone?-1:layer.Value;
				
				float _normalizedTime = normalizedTime.IsNone?Mathf.NegativeInfinity:normalizedTime.Value;
				
				_animator.CrossFade(stateName.Value,transitionDuration.Value,_layer,_normalizedTime);
			}
			
			Finish();
			
		}
Пример #3
0
 /// <summary>
 /// 由于状态跳转动画播放和状态机跳转之间会产生异步导致动画播放卡主,所以进行动画状态判断,如果当前状态动画名和播放不一样,重新播放一边
 /// </summary>
 public void FixChangeAnimationBug()
 {
     for (int i = 0; i < Fsm.ActiveState.Actions.Length; i++)
     {
         if (Fsm.ActiveState.Actions[i] as AnimatorCrossFade != null)
         {
             AnimatorCrossFade data = Fsm.ActiveState.Actions[i] as AnimatorCrossFade;
             ///如果当前播放的动画状态与状态内设置不一 强制跳转动画
             if (!_animator.GetCurrentAnimatorStateInfo(0).IsName(data.stateName.Value))
             {
                 _animator.CrossFade(data.stateName.Value, 0);
             }
         }
     }
 }
Пример #4
0
 public override void OnEnter()
 {
     animator = ownerDefault.GetComponent <UnityEngine.Animator> ();
     animator.CrossFade(hash, transitionDuration, layer);
     Finish();
 }
Пример #5
0
 public override void OnEnter()
 {
     animator.CrossFade(hash, transitionDuration, layer);
     Finish();
 }
Пример #6
0
		public override void OnEnter ()
		{
			animator = ownerDefault.GetComponent<UnityEngine.Animator> ();
			animator.CrossFade (hash, transitionDuration, layer);
			Finish ();
		}