You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			46 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
		
		
			
		
	
	
			46 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
| 
											2 years ago
										 | using UnityEngine; | ||
|  | using UnityEngine.Timeline; | ||
|  | 
 | ||
|  | namespace Game | ||
|  | { | ||
|  |     public class ClipAnimation : TimelineClipBase | ||
|  |     { | ||
|  |         private const string OverrideClip = "timeline"; | ||
|  |         private const string OverrideClipAnother = "timeline_another"; | ||
|  |         private AnimationPlayableAsset _mRealAsset; | ||
|  |         private AnimationComponent _animation; | ||
|  |         private Animator _animator; | ||
|  |         public override void OnEnter() | ||
|  |         { | ||
|  |             _mRealAsset = Asset as AnimationPlayableAsset; | ||
|  |             _animation = Owner.animation; | ||
|  |             _animator = _animation.Animator; | ||
|  | 
 | ||
|  |             _animation.IsTimelineAnother = !_animation.IsTimelineAnother; | ||
|  |             var clipName = _animation.IsTimelineAnother ? OverrideClipAnother : OverrideClip; | ||
|  |             _animation.AnimatorOverrideController[clipName] = _mRealAsset.clip; | ||
|  |             _animator.speed = (float)Speed; | ||
|  |         } | ||
|  |         public override void OnStay() | ||
|  |         { | ||
|  |             // var skill = m_Owner.skill; | ||
|  |             // var skillNow = skill.skillNow; | ||
|  |             // var skillCfg = Util.GetSkillConfig(skillNow); | ||
|  |             // if (skillCfg != null && skillCfg.StanceCache | ||
|  |             //     && skill.stance != ESkillStance.None | ||
|  |             //     && skill.stance != ESkillStance.Idle | ||
|  |             //     && skill.stance != ESkillStance.AirIdle) | ||
|  |             // { | ||
|  |             //     m_Owner.CastShadow(100); | ||
|  |             // } | ||
|  |         } | ||
|  |         public override void OnLeave() | ||
|  |         { | ||
|  |             _animator.speed = 1; | ||
|  |         } | ||
|  |         public override void OnPause(bool isPause) | ||
|  |         { | ||
|  |             _animator.speed = isPause ? 0 : (float)Speed; | ||
|  |         } | ||
|  |     } | ||
|  | } |