84 lines
2.2 KiB
C#
84 lines
2.2 KiB
C#
|
using Thousandto.Core.Asset;
|
|||
|
using Thousandto.Core.Base;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Thousandto.SkillEditor.DIY
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 1v1的link特效
|
|||
|
/// </summary>
|
|||
|
public class EditorVFXSingleLink : FGameObjectVFX
|
|||
|
{
|
|||
|
#region//私有变量
|
|||
|
//连接发送者
|
|||
|
private Transform _launcher;
|
|||
|
//连接发送者的Slot
|
|||
|
private string _launcherSlot;
|
|||
|
//连接的接受者
|
|||
|
private Transform _target;
|
|||
|
//接受者的Slot
|
|||
|
private string _targetSlot;
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//构造函数
|
|||
|
//构造函数
|
|||
|
public EditorVFXSingleLink(ModelTypeCode type, int id)
|
|||
|
: base(type, id, true, false, 0)
|
|||
|
{
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//公共接口
|
|||
|
//设置参数
|
|||
|
public void SetParams(Transform launcher, string launcherSlot, Transform target, string targetSlot)
|
|||
|
{
|
|||
|
_launcherSlot = launcherSlot;
|
|||
|
_targetSlot = targetSlot;
|
|||
|
|
|||
|
//重写设定发送者
|
|||
|
_launcher = launcher;
|
|||
|
|
|||
|
//重新设定目标者
|
|||
|
_target = target;
|
|||
|
|
|||
|
SetLinkParam(VFXComp);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//重写父类函数
|
|||
|
//获取特效的组件
|
|||
|
protected override IVFXComp OnGetVFXComp()
|
|||
|
{
|
|||
|
if (RealScript != null)
|
|||
|
{
|
|||
|
RealScript.VFXType = VFXTypeCode.SingleLink;
|
|||
|
RealScript.VFXComp.IsFinishDestroy = false;
|
|||
|
SetLinkParam(RealScript.VFXComp);
|
|||
|
return RealScript.VFXComp;
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//私有方法
|
|||
|
//设置连接的参数
|
|||
|
private void SetLinkParam(IVFXComp comp)
|
|||
|
{
|
|||
|
if (_launcher == null || _target == null || comp == null) return;
|
|||
|
|
|||
|
var link = comp as FVFXSingleLinkComp;
|
|||
|
if (link != null)
|
|||
|
{
|
|||
|
link.SetMain(SlotUtils.GetSlotTransform(_launcher, _launcherSlot));
|
|||
|
link.SetTarget(SlotUtils.GetSlotTransform(_target, _targetSlot));
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|