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.
		
		
		
		
		
			
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
| 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()
 | |
|         {
 | |
|         }
 | |
|         public override void OnLeave()
 | |
|         {
 | |
|             _animator.speed = 1;
 | |
|         }
 | |
|         public override void OnPause(bool isPause)
 | |
|         {
 | |
|             _animator.speed = isPause ? 0 : (float)Speed;
 | |
|         }
 | |
|     }
 | |
| } |