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.
		
		
		
		
		
			
		
			
	
	
		
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
| 
											2 years ago
										 | using UnityEngine; | ||
|  | using UnityEngine.Timeline; | ||
|  | 
 | ||
|  | namespace Game | ||
|  | { | ||
|  |     public class ClipThrowPosition : TimelineClipBase | ||
|  |     { | ||
|  |         private ThrowPositionClip _mRealAsset; | ||
|  |         private GameEntity target; | ||
|  | 
 | ||
|  |         public override void OnEnter() | ||
|  |         { | ||
|  |             _mRealAsset = Asset as ThrowPositionClip; | ||
|  |             target = Util.GetEntity(Owner.skill.ThrowTarget); | ||
|  |             SetPos(_mRealAsset.template.startPos); | ||
|  |         } | ||
|  | 
 | ||
|  |         public override void OnStay() | ||
|  |         { | ||
|  |             var rate = (Owner.timeline.TimePast - StartTime) / (EndTime - StartTime); | ||
|  |             var pos = Vector3.Lerp(_mRealAsset.template.startPos, _mRealAsset.template.endPos, (float)rate); | ||
|  |             SetPos(pos); | ||
|  |         } | ||
|  | 
 | ||
|  |         public override void OnLeave() | ||
|  |         { | ||
|  |             SetPos(_mRealAsset.template.endPos); | ||
|  |         } | ||
|  | 
 | ||
|  |         private void SetPos(Vector3 pos) | ||
|  |         { | ||
|  |             var relatedPos = new Vector3(pos.x * (Owner.move.IsRight ? 1 : -1), pos.y, pos.z); | ||
|  |             var targetPos = Owner.Pos() + relatedPos; | ||
|  |             target.SetPos(targetPos); | ||
|  |         } | ||
|  |     } | ||
|  | } |