|  |  | using UnityEngine;
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | namespace Game
 | 
						
						
						
							|  |  | {
 | 
						
						
						
							|  |  |     public class ClipEffect : TimelineClipBase
 | 
						
						
						
							|  |  |     {
 | 
						
						
						
							|  |  |         private EffectClip _mRealAsset;
 | 
						
						
						
							|  |  |         public override void OnEnter()
 | 
						
						
						
							|  |  |         {
 | 
						
						
						
							|  |  |             _mRealAsset = Asset as EffectClip;
 | 
						
						
						
							|  |  |             var duration = EndTime - StartTime;
 | 
						
						
						
							|  |  |             var castDir = Owner.skill.CastDir;
 | 
						
						
						
							|  |  |             castDir = new Vector3(castDir.x, 0, castDir.z);//忽略y
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |             var toGridSize = 16f / 64f;
 | 
						
						
						
							|  |  |             var isRight = Owner.move.IsRight;
 | 
						
						
						
							|  |  |             var rotf = Util.Vec3ToRot(castDir);
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |             foreach (var item in _mRealAsset.template.EffectInfos)
 | 
						
						
						
							|  |  |             {
 | 
						
						
						
							|  |  |                 var targetEntity = 0;
 | 
						
						
						
							|  |  |                 var isSpeedIgnore = item.isSpeedIgnore;
 | 
						
						
						
							|  |  |                 var rot = Quaternion.FromToRotation(Vector3.right, castDir);
 | 
						
						
						
							|  |  |                 var posAdd = rot * (item.offset * toGridSize);
 | 
						
						
						
							|  |  |                 var pos = Owner.view.PositionView + posAdd;
 | 
						
						
						
							|  |  |                 if (item.isGround)
 | 
						
						
						
							|  |  |                 {
 | 
						
						
						
							|  |  |                     pos = Owner.move.Position + posAdd;
 | 
						
						
						
							|  |  |                     pos = new Vector3(pos.x, 0, pos.z);
 | 
						
						
						
							|  |  |                 }
 | 
						
						
						
							|  |  |                 if (item.isAttach)
 | 
						
						
						
							|  |  |                 {
 | 
						
						
						
							|  |  |                     targetEntity = Owner.ID();
 | 
						
						
						
							|  |  |                 }
 | 
						
						
						
							|  |  |                 var rotFinal = GameRandom.RandomRot(rotf + item.rotAdd, item.rotAddRandom);
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                 if (item.Effect != null)
 | 
						
						
						
							|  |  |                 {
 | 
						
						
						
							|  |  |                     Util.CastEffect(item.Effect, pos, rotFinal, targetEntity, isSpeedIgnore ? 0 : duration, item.isAttach);
 | 
						
						
						
							|  |  |                 }
 | 
						
						
						
							|  |  |                 else
 | 
						
						
						
							|  |  |                 {
 | 
						
						
						
							|  |  |                     Util.Print("ClipEffect特效释放失败:未配置特效");
 | 
						
						
						
							|  |  |                 }
 | 
						
						
						
							|  |  |             }
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  |         public override void OnStay()
 | 
						
						
						
							|  |  |         {
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  |         public override void OnLeave()
 | 
						
						
						
							|  |  |         {
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  |     }
 | 
						
						
						
							|  |  | } |