using UnityEngine;
|
using System;
|
using System.IO;
|
|
#if UNITY_EDITOR
|
using UnityEditor;
|
#endif
|
|
public class SoGhostShadow : ScriptableObject
|
{
|
public int count;// 存在数量的逻辑和依据时间的逻辑互斥
|
public int duration;// 产生持续时间
|
public int interval;// 产生间隔
|
public int eachLastTime;// 每个幻影持续时间
|
|
public Color color = new Color(1f, 1f, 1f, 0.98f);// 颜色
|
public float intensity = 0.2f;// 颜色强度
|
}
|
|
#if UNITY_EDITOR
|
[CustomEditor(typeof(SoGhostShadow))]
|
public class SoGhostShadowEditor : Editor
|
{
|
[MenuItem("程序/角色相关/技能配置/残影配置")]
|
static void CreateSoGhostShadow()
|
{
|
SoGhostShadow _config = CreateInstance<SoGhostShadow>();
|
string _createName = string.Format(ScriptableObjectLoader.SoGhostShadow_Suffix,
|
DateTime.UtcNow.ToFileTimeUtc());
|
string _path = ResourcesPath.ResourcesOutPath + "refdata/ScriptableObject/SoGhostShadow/";
|
if (Directory.Exists(_path) == false)
|
{
|
Directory.CreateDirectory(_path);
|
}
|
_path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
"refdata/ScriptableObject/SoGhostShadow/",
|
_createName,
|
".asset");
|
AssetDatabase.CreateAsset(_config, _path);
|
AssetDatabase.Refresh();
|
ProjectWindowUtil.ShowCreatedAsset(_config);
|
}
|
|
public override void OnInspectorGUI()
|
{
|
serializedObject.Update();
|
|
SoGhostShadow _target = target as SoGhostShadow;
|
|
EditorGUILayout.HelpBox("数量和时间只取其一做逻辑, 当有数量的时候, 将会在此帧产生与上一帧坐标点间平均分配但是消失时间不等的残影; 如果是按照时间配置, 则为每隔一定时间产生一个残影, 总共产生多长时间. 优先时间. ", MessageType.Info, true);
|
|
GUILayout.Space(10);
|
|
_target.duration = EditorGUILayout.IntField("持续时间(毫秒)", _target.duration);
|
_target.interval = EditorGUILayout.IntField("生成间隔(毫秒)", _target.interval);
|
_target.eachLastTime = EditorGUILayout.IntField("生存时间(毫秒)", _target.eachLastTime);
|
|
_target.count = EditorGUILayout.IntField("残影总数", _target.count);
|
|
_target.color = EditorGUILayout.ColorField("残影颜色", _target.color);
|
_target.intensity = EditorGUILayout.Slider("残影强度(浮点)", _target.intensity, 0, 2);
|
|
|
if (GUI.changed)
|
{
|
EditorUtility.SetDirty(target);
|
serializedObject.ApplyModifiedProperties();
|
}
|
}
|
}
|
#endif
|