using UnityEditor; using UnityEngine; using System; using System.IO; public class SoFlyObjectEditor : SoConfigBaseEditor { [MenuItem("程序/角色相关/技能配置/SoFlyObject")] static void CreateSoFlyObject() { SoFlyObject _config = CreateInstance(); string _createName = string.Format(ScriptableObjectLoader.SoFlyObject_Suffix, DateTime.UtcNow.ToFileTimeUtc()); string _path = ResourcesPath.ResourcesOutPath + "refdata/ScriptableObject/SoFlyObject/"; if (Directory.Exists(_path) == false) { Directory.CreateDirectory(_path); } _path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "refdata/ScriptableObject/SoFlyObject/", _createName, ".asset"); AssetDatabase.CreateAsset(_config, _path); AssetDatabase.Refresh(); ProjectWindowUtil.ShowCreatedAsset(_config); } protected override void OnDrawInspectorGUI() { base.OnDrawInspectorGUI(); SoFlyObject _target = target as SoFlyObject; GUILayout.Space(5); EditorGUILayout.LabelField(string.Format("飞行物类型: {0}", _target.type), EditorStyles.largeLabel, GUILayout.Height(24)); _target.shootNode = EditorGUILayout.TextField("发射骨骼(留空为当前坐标点)", _target.shootNode); _target.ammoEffectId = EditorGUILayout.IntField("飞行物特效ID", _target.ammoEffectId); _target.blastEffectId = EditorGUILayout.IntField("爆炸特效ID", _target.blastEffectId); _target.radius = EditorGUILayout.FloatField("碰撞半径", _target.radius); _target.disppearWhenHitFinished = EditorGUILayout.Toggle("完成hit后是否消失", _target.disppearWhenHitFinished); _target.hurtInterval = EditorGUILayout.IntField("伤害间隔(毫秒)", _target.hurtInterval); _target.maxHitCount = EditorGUILayout.IntField("最大伤害次数", _target.maxHitCount); } }