99 lines
3.2 KiB
C#
99 lines
3.2 KiB
C#
using Thousandto.Code.Logic;
|
|
using Thousandto.Code.Logic.WarningField;
|
|
using Thousandto.Core.Asset;
|
|
using Thousandto.Core.Base;
|
|
using Thousandto.SkillEditor;
|
|
using Thousandto.SkillEditor.DIY;
|
|
using Thousandto.SkillEditor.Support;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Thousandto.SkillEditor.DIY
|
|
{
|
|
public enum EditorObjType
|
|
{
|
|
Player,
|
|
Monster,
|
|
SkillSimpleObj,
|
|
SkillObj,
|
|
}
|
|
//对象基类
|
|
public class EditorBaseObject
|
|
{
|
|
public static bool ShowSkillRange = true;
|
|
|
|
public Transform RootTrans { get; private set; }
|
|
public GameObject RootGo { get; private set; }
|
|
public GameObject WarningRoot { get; private set; }
|
|
public EditorObjType ObjType { get; private set; }
|
|
|
|
public Vector3 Position
|
|
{
|
|
get
|
|
{
|
|
return RootTrans.position;
|
|
}
|
|
set
|
|
{
|
|
RootTrans.position = value;
|
|
}
|
|
}
|
|
|
|
public void AddWarningField(FindTargetInfo findData)
|
|
{
|
|
if (!ShowSkillRange)
|
|
return;
|
|
WarningRoot.transform.localScale = new Vector3(1f / RootTrans.localScale.x, 1f / RootTrans.localScale.y, 1f / RootTrans.localScale.z);
|
|
|
|
RemoveWarningField();
|
|
switch (findData.AreaType)
|
|
{
|
|
case SkillTargetArea.Rectangle:
|
|
NewWarningFiled.AddRectWarningField(WarningRoot, findData.RectWidth, findData.RectHeight, findData.StartDis);
|
|
break;
|
|
case SkillTargetArea.FanShaped:
|
|
NewWarningFiled.AddFanShapedWarningField(WarningRoot, findData.SectorAngle, findData.SectorRadius, findData.StartDis);
|
|
break;
|
|
case SkillTargetArea.Round:
|
|
NewWarningFiled.AddRoundWarningField(WarningRoot, findData.RoundRadius, findData.StartDis);
|
|
break;
|
|
}
|
|
}
|
|
public void RemoveWarningField()
|
|
{
|
|
NewWarningFiled.DeleteWarningField(WarningRoot);
|
|
}
|
|
|
|
public EditorBaseObject(GameObject rootGo, EditorObjType objType)
|
|
{
|
|
RootGo = rootGo;
|
|
RootTrans = rootGo.transform;
|
|
ObjType = objType;
|
|
|
|
WarningRoot = new GameObject("[WarningRoot]");
|
|
WarningRoot.transform.parent = RootTrans;
|
|
UnityUtils.Reset(WarningRoot.transform);
|
|
WarningRoot.transform.localPosition = new Vector3(0f, 0.2f, 0f);
|
|
}
|
|
|
|
public EditorVFXScript PlayVFX(int vfxID, string slotName)
|
|
{
|
|
var resPath = AssetUtils.GetModelAssetPath(ModelTypeCode.SkillVFX, vfxID);
|
|
var slot = SlotUtils.GetSlotTransform(RootTrans, slotName);
|
|
var vfx = EditorVFXPlayer.Instance.PlayVFX(resPath, slot);
|
|
return vfx;
|
|
}
|
|
|
|
public EditorVFXScript PlayVFX(int vfxID)
|
|
{
|
|
var resPath = AssetUtils.GetModelAssetPath(ModelTypeCode.SkillVFX, vfxID);
|
|
var vfx = EditorVFXPlayer.Instance.PlayVFX(resPath, null);
|
|
return vfx;
|
|
}
|
|
}
|
|
}
|